Sitemap
Mr. Riyas

Mr. Riyas

Salesforce Enthusiast | Architect | Developer | Open to Help

Salesforce Flows: Key Considerations for InvocableVariable

2 min readJun 26, 2025

--

Ever wondered how to make your Apex variables play nicely with Salesforce Flows? The @InvocableVariable annotation is your key! But before you start, here are some crucial considerations to keep in mind:

By keeping these points in mind, you’ll be well on your way to leveraging the full power of @InvocableVariable for robust and dynamic Salesforce Flows!

Press enter or click to view image in full size

1. Exclusivity is Key

Think of @InvocableVariable as a VIP pass – it doesn't like to share! You cannot use other annotations alongside it. It wants to be the star of the show.

2. Accessibility Matters

Only variables with global or public access modifiers can be invocable. This ensures your Flows can "see" and interact with them.

3. What NOT to Use

Avoid using these types of variables with @InvocableVariable:

    Get Mr. Riyas’s stories in your inbox

    Join Medium for free to get updates from this writer.

  • Non-member variables: Static or local variables are out.
  • Properties: Getters and setters aren’t supported here.
  • Final variables: Once set, final variables can’t be changed, which defeats the purpose of an invocable variable.
  • Protected or private variables: These aren’t accessible to Flows.

4. Supported Data Types

Your invocable variables need to speak Flow’s language! The data types must be one of the following:

  • Primitives: Any primitive data type except Object.
  • sObjects: Both generic sObject and specific sObjects (like Account or Contact).
  • Collections: List or List of List of primitives, sObjects, or objects created from Apex classes.

5. Name Matching (Case-Sensitive!)

This is crucial for seamless integration! The name of your invocable variable in Apex must exactly match the name you use in the Flow. Remember, it’s case-sensitive!

6. Managed Package Considerations

If you’re working with managed packages, keep these points in mind:

  • Public invocable variables: Can only be set in Flows and Processes within the same managed package.
  • Global invocable variables: These are the most flexible! They can be set anywhere in the subscriber org and are the only invocable variables that appear in Flow Builder and Process Builder for subscribers.

--

--

Mr. Riyas
Mr. Riyas

Written by Mr. Riyas

Salesforce Enthusiast | Architect | Developer | Open to Help