1

BACKGROUND

I have a class with an InvocableMethod which takes a set of InvocableVariable's

Such that I can call the Apex class from Process Builder.

QUESTION

I would like one of the fields to appear as a dropdown list of options when configuring within Process Builder.

ATTEMPTS

I have tried setting the InvocableVariable type as a custom class:

global class TestType { 

    public final String VALUE_ONE = 'one';
    public final String VALUE_TWO = 'two';

}

And I have tried setting the InvocableVariable type as an Enum:

public enum Season 
{
    WINTER, 
    SPRING, 
    SUMMER, 
    FALL
}

Both give me an error of:

InvocableVariable fields do not support type of XXX

How do I define the InvocableVariable such that I can pick from a set of options?

2

It's not possible.

The invocable variable can’t be one of the following:

  • A type such as an interface, class, or enum.

  • A non-member variable such as a static or local variable.

  • A property. A final variable. Protected or private.

The data type of the invocable variable must be one of the following:

  • A primitive data type or a list of a primitive data type – the generic Object type is not supported.

  • An sObject type or a list of an sObject type – the generic sObject type is not supported.

Reference:

| improve this answer | |
1

So, one option would be to define (or reuse an existing) Sobject Foo__c with a custom picklist field that has the value set you care about.

Seasons__c type picklist with values SPRING, ...

Then have the invocable method support a list of Foo__c as the argument. This will provide the dropdown values you need.

| improve this answer | |
  • @Robs -- Have the PB invoke a Visual Flow that in turn calls the invocableApex using custom Sobject Foo__c. VisualFlow supports choosing from existing picklist values in the Assignment operation – cropredy Jul 9 '18 at 19:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.