Decision Table Actions

Invoke a decision table.

Decision tables provide outcomes based on your business rules. For more information about invoking decision tables, see Invoke a Decision Table in Salesforce Help.

This object is available in API version 51.0 and later.

Supported REST HTTP Methods 

Formats: JSON

HTTP Methods: GET, POST

Authentication: Authorization: Bearer TOKEN

Where TOKEN is a variable.

The specific URI endpoint and the structure of the JSON payload depend on whether a dataset link is configured for your decision table. To check if a dataset link is enabled for your decision table, you can query the DecisionTableDataLink table. If an entry for your decision table exists in this table, a dataset link is active. For more information about dataset links, see DecisionTableDatasetLink.

Decision Table Without Dataset Link 

If your decisionTableId isn’t found in the DecisionTableDatasetLink table, you must append _Default to your decision table’s API name to construct the endpoint URI.

URI: /services/data/vXX.X/actions/custom/decisionTableAction/dtapi_Default

Where XX.X is the latest API version.

Decision Table With Dataset Link 

If your decisionTableId is present in the DecisionTableDatasetLink table, the endpoint URI uses the API name of the dataset link.

URI: /services/data/vXX.X/actions/custom/decisionTableAction/dslapiname

Where XX.X is the latest API version.

Inputs 

You can choose to invoke a decision table with or without dataset link.

To execute a default Decision Table without dataset link, specify the input fields that were defined at the time of the Decision Table creation in the flow. The input fields are optional. However, you must specify at least one field as the input parameter. Use the GET method to retrieve input parameters of a Decision Table definition.

For example, to decide discount percentage for products, you can pass the input parameters, including Brand__c, Highest_Price_Point_c, and Lowest_Price_Point_c.

Note

To execute a Decision Table with dataset link, specify the list that contains the source object and its corresponding field to be used in the dataset link that is associated with the decision table.

InputTypeDescription
sObjectTypesObjectThe name of the dataset link’s object whose records, the decision table must provide an outcome for.

Outputs 

OutputTypeDescription
outcomeListsObjectOutcome list that stores two or more outcomes provided by the decision table.
Note: A decision table that is invoked by the Decision Table custom invocable action can provide up to 50 outcomes.
outcomeTypestringIndicates the type of outcome provided by the decision table after the request is successful. Valid values are:
  • Multiple Match—Outcome returns multiple matches.
  • No Match—Outcome returns no match.
  • Single Match—Outcome returns single match.
singleOutcomesObjectStores the outcome in case a single outcome is provided by the decision table. In case multiple outcomes are provided, it stores one of the outcomes.

Usage 

JSON Sample Request without dataset link

When you invoke a decisionTableAction without a dataset link, the request contains an array of input objects.

1{
2   "inputs" : [
3      {
4        "Product__c": "Cloud Kicks",
5        "Price__c": 1000
6      }
7   ]
8}

JSON Sample Request with dataset Link

When you invoke a decisionTableAction with a dataset link, the input objects in the request are nested within another object, which is typically the name of the transaction object.

1{
2   "inputs" : [
3      {
4         "Transaction__c" : {
5            "Product__c": "Cloud Kicks",
6            "Price__c": 1000
7         }
8      }
9   ]
10}

JSON Sample Request with dataset Link containing multiple source objects

1{
2   "inputs" : [
3      {
4         "Transaction__c" : {
5            "Product__c": "Cloud Kicks",
6            "Price__c": 1000
7         }
8      }
9      {
10         "Catalog__c" : {
11            "name": "Highest_Price_Point_c",
12            "value": "500",
13         }
14      }
15   ]
16}

JSON Sample Response

1[{
2   “outcomeType” : “SINGLE MATCH”,
3   “singleOutcome”: { “Points”: 100 },
4   "outcomeList" : [
5      {
6         “Points”: 100
7      }
8   ]
9}]