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.


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


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 

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?


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.



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.

  • @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

@Robs i am not sure if you manage to find best possible solution.

I use to do like this, so at least user know possible values for the parameter.

    @InvocableVariable(label='Season' description='Type one of these WINTER, SPRING, SUMMER, FALL' required=true)
    public String season;

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.