Loading
Context Service
Generate an Apex Class for a Context Definition

Generate an Apex Class for a Context Definition

View definition-specific invocable actions in Salesforce Flow by generating Apex classes from your context definitions. The Apex classes mirror the metadata and hierarchy of your context definition, which can be used directly in Salesforce Flow without any coding required.

Required Editions

Available in: Lightning Experience
Available in: Developer, Enterprise, Professional, and Unlimited editions for Industries clouds where Context Service is enabled
User Permissions Needed
To generate Apex classes: Context Service Admin
To create a flow: Manage Flow
To invoke context service actions:

Context Service Admin

OR

Context Service Runtime

  1. From Setup, in the Quick Find box, enter Context Service, then select Context Definitions.
  2. Select the context definition for which you want to generate an Apex class.
  3. Click Generate Apex Class.
  4. To view the generated Apex classes
    1. From Setup, in the Quick Find box, enter Apex Class, then select Apex Class.
    2. Search for the API name of your context definition.

Once an Apex class is generated, it can’t be edited. To delete an Apex class, go to the context definition page and click Delete Apex Class.

Important
Important Deleting Apex classes can break Flows that use them. Make sure to remove the associated classes from all your Flow elements.

To refresh the Apex classes of a context definition you have edited, go to the context definition page and click Refresh Apex Class.

Important
Important When a custom context definition is updated, the associated Apex classes are not automatically updated. You must manually refresh the Apex classes.
 
Loading
Salesforce Help | Article