Expression Set Actions

Invoke an active expression set. An expression set is a user-defined rule that accepts an input and returns the output based on the configured function.

The configured function of an expression set can be a simple decision matrix lookup, a calculation based on a mathematical formula, a condition, or another expression set.

When a Flow is invoked using Batch management (for example, for processing 200 records), the calls to expression sets are automatically bulkified, which allows the execution of multiple inputs in a single request.

These actions are available in API version 55.0 and later.

Supported REST HTTP Methods 

URI: /services/data/vXX.X/actions/custom/runExpressionSet/{ApiName}

Where XX.X is the latest API version.

The API name of an expression set is unique within your Salesforce instance.

Note

Formats: JSON

HTTP Methods: POST

Authentication: Authorization: Bearer TOKEN

Where TOKEN is a variable.

Inputs 

Inputs vary depending on the selected expression set. For expression sets tied to a context definition, you can build and persist context data using additional inputs.

InputTypeDescription
__<ContextNode>​RecordIdsList<String>Optional. A collection of context node record IDs to be built.
__mappingNameStringOptional. The default context mapping available in the context definition.
__persist​ContextDataBooleanOptional. Indicates whether to save context data to the database (true) or not (false).
__buildContextStringOptional. Indicates whether to build the context using the IDs of context definition records in the database.

For context-based expression sets, provide either the context ID or the build context parameters. If both are provided and __buildContext is true, the context ID is ignored and the context is built from the input record IDs.

Outputs 

Vary depending on the inputs of the selected expression set.

Usage 

When the expression set is not linked with a context

This section has the sample request and response for invoking an expression set with these steps.

  1. Find the tax percentage and the premium corresponding to specific age and salary using a decision matrix lookup.
  2. Check the age criterion to calculate the total tax.
  3. Calculate the total tax to be paid based on the age group, salary, and the tax percentage.

Sample request

Here’s an example POST request that has the inputs, such as, age and salary.

1{
2  "inputs": [
3    {
4      "Age": "25.00",
5      "Salary": "50000.00"
6    },
7    {
8      "Age": "30.00",
9      "Salary": "70000.00"
10    },
11    {
12      "Age": "40.00",
13      "Salary": "90000.00"
14    }
15  ]
16}

Sample response

Here’s an example response that has the premium and tax values based on the inputs provided in the example request.

1[
2  {
3    "actionName": "TaxPremiumES",
4    "errors": null,
5    "isSuccess": true,
6    "outputValues": {
7      "TaxPremium__Premium": 1000,
8      "TaxPremium__Tax": 10,
9      "TaxToBePaid": 1050,
10      "condition_output__2": "false",
11      "condition_output__1": "true"
12    }
13  },
14  {
15    "actionName": "TaxPremiumES",
16    "errors": null,
17    "isSuccess": true,
18    "outputValues": {
19      "TaxPremium__Premium": 1500,
20      "TaxPremium__Tax": 12,
21      "TaxToBePaid": 1512,
22      "condition_output__2": "true",
23      "condition_output__1": "false"
24    }
25  },
26  {
27    "actionName": "TaxPremiumES",
28    "errors": null,
29    "isSuccess": true,
30    "outputValues": {
31      "TaxPremium__Premium": 2000,
32      "TaxPremium__Tax": 15,
33      "TaxToBePaid": 2015,
34      "condition_output__2": "false",
35      "condition_output__1": "true"
36    }
37  }
38]

When the expression set is linked with a context

An expression set can be configured with a context definition. In this case, the expression set runs using context data that is either provided directly or built at runtime.

Sample request when context ID is available

Here’s an example request that runs a context-based expression set using an existing context ID.

1{
2  "inputs": [
3    {
4      "Claim2Id": "55304396580d20ffbae5111a641ab0a747ffbe47dfab2b16df35df9ac87184fc",
5      "inputVar1": 10
6    }
7  ]
8}

Sample response

Here’s an example response for a context-based expression set execution.

1[
2  {
3    "actionName": "ClaimProcessingES",
4    "errors": null,
5    "isSuccess": true,
6    "outputValues": {
7      "Claim2Id": "55304396580d20ffbae5111a641ab0a747ffbe47dfab2b16df35df9ac87184fc",
8      "inputVar1": 10
9    }
10  }
11]

Sample request when context ID is not available

When an expression set is tied to a context definition and a context ID isn’t available, use the __buildContext parameter to build the context before the expression set runs. You can also persist the context data to the database after execution by setting __persistContextData to true.

Here’s an example POST request that builds the context, runs the expression set, and persists the context data.

1{
2  "inputs": [
3    {
4      "inputVar1": 10,
5      "__buildContext": true,
6      "__StudentRecordIds": ["a02xx000001nf9nAAA"],
7      "__mappingName": "Default Mapping",
8      "__persistContextData": true
9    }
10  ]
11}

Sample response

Here’s an example response that includes the context ID that was built during execution.

1[
2  {
3    "actionName": "StudentEligibilityES",
4    "errors": null,
5    "isSuccess": true,
6    "outputValues": {
7      "StudentId": "55304396580d20ffbae5111a641ab0a747ffbe47dfab2b16df35df9ac87184fc",
8      "inputVar1": 10
9    }
10  }
11]