Newer Version Available
RecommendationStrategy
File Suffix and Directory Location
RecommendationStrategy components have the suffix .recommendationStrategy and are stored in the recommendationStrategies folder.
Version
RecommendationStrategy components are available in API version 45.0 and later.
Special Access Rules
Metadata access for the RecommendationStrategy type is backed by the ManageRecommendationStrategies user permission.
Fields
| Field Name | Field Type | Description |
|---|---|---|
| actionContext | StrategyAction[] | An array of action contexts used by the strategy. |
| contextRecordType | string | The sObject type of the $record used by the flow. |
| description | string | Description of the recommendation strategy. |
| filter | StrategyNodeFilter[] | An array of filter nodes. |
| if | StrategyNodeIf[] | An array of if nodes. |
| invocableAction | StrategyNodeInvocableAction[] | An array of Apex invocable action nodes. Available in API version 46.0 and later. |
| isTemplate | boolean | Indicates whether the recommendation strategy is a template (true) or not (false). When installed from managed packages, recommendation strategies can’t be viewed or cloned by subscribers because of intellectual property (IP) protection. But when those recommendation strategies are templates, subscribers can open them in a builder, clone them, and customize the clones. The default value of this field is false. Available in API version 47.0 and later. |
| label | string | Required. Label for the flow. |
| map | StrategyNodeMap[] | An array of map nodes. Available in API version 46.0 and later. |
| mutuallyExclusive | StrategyNodeExclusive[] | An array of mutuallyExclusive nodes. |
| onBehalfOfExpression | string | Formula expression defining the intended target of the recommendations (in other words, the Contact associated with a Case). Mainly used for reaction tracking. |
| recommendationLimit | StrategyNodeRecommendationLimit[] | An array of recommendation limit nodes. |
| recommendationLoad | StrategyNodeRecommendationLoad[] | An array of recommendation load nodes. |
| sort | StrategyNodeSort[] | An array of sort nodes. |
| union | StrategyNodeUnion[] | An array of union nodes. |
StrategyNodeBase
Base class for all strategy nodes. This is an abstract class.
| Field Name | Field Type | Description |
|---|---|---|
| childNode | string | Array of child node names, in order of execution. |
| description | string | Description of the node. |
| label | string | Label of the node. |
| name | string | Required. Unique name of the node. |
StrategyAction
Defines a call to an invocable action from the strategy. Results are used by decision elements in the strategy.
| Field Name | Field Type | Description |
|---|---|---|
| action | string | Required. The name or id of the InvocableAction to execute. |
| argument | StrategyActionArg[] | List of strategy action arguments. |
| description | string | Description of the strategy. |
| label | string | Label for the strategy action. |
| name | string | Required. Unique name of the strategy action, which is referenced by decisioning elements in the strategy. |
| type | InvocableActionType (enumeration of type string) | Required. The action type. Valid values are:
These values are used in the B2B Commerce Checkout Flow. If no version is specified, the value is available in API version 47.0 and later.
For values used in Business Rules Engine, see Flow for Business Rules Engine. These values are used in Context Service. If no version is specified, the value is available in API version 64.0 and later.
These values are used in the Commerce Checkout Flow. If no version is specified, the value is available in API version 55.0 and later.
These values are used in Data Cloud. If no version is specified, the value is available in API version 64.0 and later.
These values are used in Salesforce CMS Workflows and Approvals. If no version is specified, the value is available in API version 58.0 and later.
These values are used in Employee Service. If no version is specified, the value is available in API version 64.0 and later.
These values are used in Insurance. If no version is specified, the value is available in API version 63.0 and later.
For values used in Financial Services Cloud, see Flow for Financial Services Cloud. For values used in Fundraising for Nonprofit Cloud, see Flow for Fundraising. For values used in Health Cloud, see Flow for Health Cloud. For values used in Manufacturing Cloud, see Flow for Manufacturing Cloud. This value is used in Omnistudio.
These values are used in Rebate Management.
These values are used in B2B Referral Management. If no version is specified, the value is available in API version 64.0 and later.
These values are used in Referral Marketing.
These values are used in Loyalty Management.
These values are for Decision Table.
These values are for the Batch Management jobs.
This value is for Data Processing Engine.
This value is used for Einstein Visit Recommendation.
For values used in Intelligent Form Reader, see Flow for Intelligent Form Reader. For values used in Intelligent Document Reader, see Flow for Intelligent Document Reader. This value is used in Public Sector Solutions.
These values are used in Unified Catalog. If no version is specified, the value is available in API version 64.0 and later.
|
StrategyActionArg
Defines arguments passed to invocable actions associated with a strategy action.
| Field Name | Field Type | Description |
|---|---|---|
| name | string | Required. Unique name for the parameter to pass to the invocable action. |
| value | string | Required. A Salesforce formula expression that is evaluated with the result being used as the parameter value for the Strategy Action. |
StrategyNodeUnionBase
Base class for nodes that perform a union of their children. Union nodes combine the outputs of their children to form the input to themselves. StrategyNodeUnionBase extends StrategyNodeBase and inherits all of its fields. This is an abstract class.
| Field Name | Field Type | Description |
|---|---|---|
| limit | int | Maximum number of results to output. |
StrategyNodeFilter
Defines a filter element that filters recommendations. It extends StrategyNodeUnionBase and inherits all its fields.
| Field Name | Field Type | Description |
|---|---|---|
| expression | string | Required. A formula expression that results in a boolean value when executed on each recommendation in the node’s input. Inputs that result in true form the output, and inputs that result in false are excluded. |
StrategyNodeIf
Selects specific children to execute and combines their results. Executes and returns results of children based on the array of child node expressions. Extends StrategyNodeUnionBase and inherits all of its fields.
| Field Name | Field Type | Description |
|---|---|---|
| childNodeExpression | IfExpression[] | Array of if expressions. |
| onlyFirstMatch | boolean | If true, selects only the results from the matching child. If false, selects and combines results from all matching children. The default value is false. |
IfExpression
Expression used by StrategyNodeIf.
| Field Name | Field Type | Description |
|---|---|---|
| childName | string | Required. Name of child to match. |
| expression | string | Required. Formula expression returning true or false. |
StrategyNodeInvocableAction
Defines an element that calls an Apex invocable action to generate or enhance a list of recommendations. It extends StrategyNodeUnionBase and inherits all its fields.
| Field Name | Field Type | Description |
|---|---|---|
| action | string | Required. The name of the invocable action to execute. |
| argument | StrategyNodeInvocableActionArg[] | List of arguments that are passed to the invocable action. |
| isGenerator | boolean | Required. If true, the UI displays the Generate element. If false, the UI displays the Enhance element. Defaults to false. |
| type | InvocableActionType (enumeration of type string) | Required. The action type. Valid
values are:
These values are used in the B2B Commerce Checkout Flow. If no version is specified, the value is available in API version 47.0 and later.
For values used in Business Rules Engine, see Flow for Business Rules Engine. These values are used in Context Service. If no version is specified, the value is available in API version 64.0 and later.
These values are used in the Commerce Checkout Flow. If no version is specified, the value is available in API version 55.0 and later.
These values are used in Salesforce CMS Workflows and Approvals. If no version is specified, the value is available in API version 58.0 and later.
These values are used in Employee Service. If no version is specified, the value is available in API version 64.0 and later.
These values are used in Financial Services Cloud.
For values used in Fundraising for Nonprofit Cloud, see Flow for Fundraising. For values used in Health Cloud, see Flow for Health Cloud. For values used in Manufacturing Cloud, see Flow for Manufacturing Cloud. This value is used in Omnistudio.
These values are used in Rebate Management.
These values are used in B2B Referral Management. If no version is specified, the value is available in API version 64.0 and later.
These values are used in Referral Marketing.
These values are used in Loyalty Management.
These values are for Decision Table.
These values are for the Batch Management jobs.
This value is for Data Processing Engine.
This value is used for Einstein Visit Recommendation.
For values used in Intelligent Form Reader, see Flow for Intelligent Form Reader. For values used in Intelligent Document Reader, see Flow for Intelligent Document Reader. This value is used in Public Sector Solutions.
These values are used in Unified Catalog. If no version is specified, the value is available in API version 64.0 and later.
|
StrategyNodeInvocableActionArg
Defines arguments passed to an Apex invocable action that generates or enhances a list of recommendations.
| Field Name | Field Type | Description |
|---|---|---|
| name | string | Required. Unique name for the parameter to pass to the invocable action. The name must match a parameter that's defined in the invocable action. |
| value | string | Required. A Salesforce formula expression that is evaluated with the result used as the parameter value for the action. |
StrategyNodeRecommendationLimit
Filters out recommendations that have already been accepted or rejected. Extends StrategyNodeUnionBase and inherits all of its fields.
StrategyNodeRecommendationLoad
Retrieves Recommendation objects. Extends StrategyNodeUnionBase and inherits all of its fields.
| Field Name | Field Type | Description |
|---|---|---|
| condition | RecommendationLoadCondition[] | Array of conditions specifying which recommendations to load. |
| conditionLogic | string | Logic to combine conditions, either AND or OR. All conditions are combined (not mixed). For example: Cond1 AND Cond2 AND Cond3. |
| object | string | Required. Specifies the API name of the sObject from which recommendations are loaded. For example, the field references Account or MyCustomObject__c and not a specific record of that object. Available in API version 48.0 and later. |
| sortField | StrategyNodeSortField | The field to sort on. Available in API version 48.0 and later. |
RecommendationLoadCondition
Represents a condition used as part of the query constructed by StrategyNodeRecommendationLoad.
| Field Name | Field Type | Description |
|---|---|---|
| field | string | Required. Any field from Recommendation BPO (SOAP) object. |
| operator | RecommendationConditionOperator (enumeration of type string) | Required.
|
| value | RecommendationConditionValue | Required. Constant value to use in query. |
StrategyNodeSortField
Defines the field to sort on for StrategyNodeSort and StrategyNodeRecommendationLoad.
| Field Name | Field Type | Description |
|---|---|---|
| name | string | Required. Name of the field to sort. |
| nullsFirst | boolean | If true, null values are sorted to the beginning of the list. Defaults to false. |
| order | SortOrder (enumeration of type string) |
Order in which the list is sorted. Defaults to Asc. Valid values are:
|
StrategyNodeSort
Sorts the recommendations. Extends StrategyNodeUnionBase and inherits all of its fields.
| Field Name | Field Type | Description |
|---|---|---|
| field | StrategyNodeSortField | Required. Field to sort on. |
StrategyNodeUnion
StrategyNodeUnion combines the output of all its child nodes. StrategyNodeUnion is a concrete implementation of StrategtNodeUnionBase and inherits all its fields.
StrategyNodeMap
Set recommendation fields with values. Extends StrategyNodeUnionBase and inherits all of its fields.
| Field Name | Field Type | Description |
|---|---|---|
| mapExpression | MapExpression[] | List of MaxExpressions. |
StrategyNodeExclusive
Returns results from the first child node that has results and no other. Extends StrategyNodeUnionBase and inherits all its fields.
MapExpression
Sets the value for a recommendation field used by the strategy.
| Field Name | Field Type | Description |
|---|---|---|
| expression | string | Required. A formula expression that results in a valid value supported by the data type specified in the type field. |
| name | string | Required. Recommendation field name that the expression sets the value for. |
| type | string | Required. The data type of the value resulting from the value in the
expression field.
|
Declarative Metadata Sample Definition
The following is an example of a RecommendationStrategy component that references the previous definition.
1<?xml version="1.0" encoding="UTF-8"?>
2<RecommendationStrategy xmlns="http://soap.sforce.com/2006/04/metadata">
3 <contextRecordType>Asset</contextRecordType>
4 <description>Hills Brothers Coffee strategy to handle machine down incidents</description>
5 <if>
6 <childNode>IfNoEscaladeOrBetterSupport</childNode>
7 <childNode>IfModel</childNode>
8 <description>If Machine Down</description>
9 <label>RootNode</label>
10 <name>RootNode</name>
11 <childNodeExpression>
12 <childName>IfModel</childName>
13 <expression>ISPICKVAL($Record.Status, "OutOfOrder")</expression>
14 </childNodeExpression>
15 <childNodeExpression>
16 <childName>IfNoEscaladeOrBetterSupport</childName>
17 <expression>ISPICKVAL($Record.Status, "OutOfOrder")</expression>
18 </childNodeExpression>
19 <onlyFirstMatch>false</onlyFirstMatch>
20 </if>
21 <if>
22 <childNode>LoadEscalade</childNode>
23 <description>If Customer does not have escalade support plan</description>
24 <label>IfNoEscaladeOrBetterSupport</label>
25 <name>IfNoEscaladeOrBetterSupport</name>
26 <childNodeExpression>
27 <childName>LoadEscalade</childName>
28 <expression>NOT(ISPICKVAL($Record.Account.SLA__c, "Gold") || ISPICKVAL($Record.Account.SLA__c, "Platinum"))</expression>
29 </childNodeExpression>
30 <onlyFirstMatch>false</onlyFirstMatch>
31 </if>
32 <if>
33 <childNode>LoadMiniDiagnostic</childNode>
34 <childNode>LoadMaxiDiagnostic</childNode>
35 <description>If Machine Model switch node</description>
36 <label>IfModel</label>
37 <name>IfModel</name>
38 <childNodeExpression>
39 <childName>LoadMiniDiagnostic</childName>
40 <expression>$Record.Product2.Name == "Mini Coffee Roaster"</expression>
41 </childNodeExpression>
42 <childNodeExpression>
43 <childName>LoadMaxiDiagnostic</childName>
44 <expression>$Record.Product2.Name == "Maxi Coffee Roaster"</expression>
45 </childNodeExpression>
46 <onlyFirstMatch>false</onlyFirstMatch>
47 </if>
48 <label>HillsBrothersCoffee</label>
49 <recommendationLoad>
50 <description>Load upgrade to escalade support plan</description>
51 <label>LoadEscalade</label>
52 <name>LoadEscalade</name>
53 <condition>
54 <field>Name</field>
55 <operator>EQUALS</operator>
56 <value>
57 <type>TEXT</type>
58 <value>Upgrade your Maintenance Package</value>
59 </value>
60 </condition>
61 <conditionLogic>and</conditionLogic>
62 </recommendationLoad>
63 <recommendationLoad>
64 <description>Load Mini Coffee Roaster Diagnostic Troubleshooting proposition</description>
65 <label>LoadMiniDiagnostic</label>
66 <name>LoadMiniDiagnostic</name>
67 <condition>
68 <field>Name</field>
69 <operator>EQUALS</operator>
70 <value>
71 <type>TEXT</type>
72 <value>Mini Coffee Roaster Diagnostic Troubleshooting</value>
73 </value>
74 </condition>
75 <conditionLogic>and</conditionLogic>
76 </recommendationLoad>
77 <recommendationLoad>
78 <description>Load Maxi Coffee Roaster Diagnostic Troubleshooting proposition</description>
79 <label>LoadMaxiDiagnostic</label>
80 <name>LoadMaxiDiagnostic</name>
81 <condition>
82 <field>Name</field>
83 <operator>EQUALS</operator>
84 <value>
85 <type>TEXT</type>
86 <value>Maxi Coffee Roaster Diagnostic Troubleshooting</value>
87 </value>
88 </condition>
89 <conditionLogic>and</conditionLogic>
90 </recommendationLoad>
91 <union>
92 <childNode>RootNode</childNode>
93 <label>Output</label>
94 <name>Output</name>
95 </union>
96 <invocableAction>
97 <action>MyInvocableApexClass</action>
98 <isGenerator>true</isGenerator>
99 <type>apex</type>
100 <argument>
101 <name>MyNameParam</name>
102 <value>$User.FirstName</value>
103 </argument>
104 <argument>
105 <name>MyIdParam</name>
106 <value>$Record.Id</value>
107 </argument>
108 </invocableAction>
109 <map>
110 <expression>
111 <name>Name</name>
112 <expression>'Hello' & $User.FirstName</expression>
113 <type>TEXT</type>
114 </expression>
115 <expression>
116 <name>MyDynamicField</name>
117 <expression>Id == $Record.Id</expression>
118 <type>BOOLEAN</type>
119 </expression>
120 </map>
121</RecommendationStrategy>Wildcard Support in the Manifest File
This metadata type supports the wildcard character * (asterisk) in the package.xml manifest file. For information about using the manifest file, see Deploying and Retrieving Metadata with the Zip File.