Loading
Salesforce now sends email only from verified domains. Read More
Business Rules Engine
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Invocable Actions

          Invocable Actions

          You can invoke decision matrices and expression sets—the Business Rules Engine components—by using Apex or REST API.

          Required Editions

          Available in: Lightning Experience
          Available in: Enterprise, Unlimited, and Developer Editions for clouds that have Business Rules Engine enabled

          Apex Classes

          To invoke expression set and decision matrix actions using Apex, use the Invocable namespace, which contains the required classes and methods. See Invocable Namespace.

          To call expression sets that have a context definition, you must first hydrate the context definition and then use Context IDs that you use to hydrate context data in the payload. See Create a Context Definition

          Important
          Important Apex runs in system context, which overrides the user's current permissions. Ensure that you manage user permissions to prevent users without the necessary permission sets from accessing expression sets and decision matrices.
          Example
          Example Invoking an expression set with Apex:
          Invocable.Action action = Invocable.Action.createCustomAction('runExpressionSet', 'ESTest');
          action.setInvocationParameter('v1', 20);
          action.setInvocationParameter('v2', 2);
          List<Invocable.Action.Result> results = action.invoke();
          Invoking an expression set with context definitions with Apex:
          Invocable.Action action = Invocable.Action.createCustomAction('runExpressionSet', 'ESTest');
                  action.setInvocationParameter('v1', 20);
                  action.setInvocationParameter('v2', 2);
                  action.setInvocationParameter('PricingContextId', <HydratedContextId>);
                  List<Invocable.Action.Result> results = action.invoke();
          Invoking a decision matrix with Apex:
          Invocable.Action action = Invocable.Action.createCustomAction('runDecisionMatrix', 'SampleMatrix);
          action.setInvocationParameter('v1', 20);
          action.setInvocationParameter('v2', 2);
          List<Invocable.Action.Result> results = action.invoke();
          Invoking a decision table with Apex:
          Invocable.Action action = Invocable.Action.createCustomAction('decisionTableAction', 'TestDTAsset_Default');
          List<Map<String, Object>> bulkInput = new List<Map<String, Object>>();
                  for(Integer i = 0; i<2; i++)
                  {
                      Integer newInput1 = 101; 
                      Integer newInput2 = 101;
                      Map<String, Object> input = new Map<String, Object>();
                      input.put('Price', newInput1); 
                      input.put('Quantity', newInput2);  
                      bulkInput.add(input);
                  }
          action.setInvocations(bulkInput);
          List<Invocable.Action.Result> results = action.invoke();
          system.debug(results);
           
          Loading
          Salesforce Help | Article