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. |
| label | string | Required. Label for the flow. |
| 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 will be referenced by decisioning elements in the strategy. |
| type | InvocableActionType (enumeration of type string) | Required. Type of the invocable action. See the enum InvocableActionType. |
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 will 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. |
StrategyNodeExclusive
Returns results from the first child node that has results and no other. Extends StrategyNodeUnionBase and inherits all its fields.
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. |
StrategyNodeRecommendationLimit
Filters out recommendations that have already been accepted or rejected. Extends StrategyNodeUnionBase and inherits all of its fields.
| Field Name | Field Type | Description |
|---|---|---|
| filterMode | StrategyReactionType (enumeration of type string) |
Available reactions to filter out. The valid values are:
|
| lookbackDuration | int | Number of days to search back. |
| maxRecommendationCount | int | Maximum number of times recommendation has been accepted or rejected. |
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. |
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. |
RecommendationConditionValue
Represents a value used as part of a RecommendationCondition.
| Field Name | Field Type | Description |
|---|---|---|
| type | RecommendationConditionValueType (enumeration of type string) | Required.
|
| value | string | Required. The constant value. |
StrategyNodeSort
Sorts the recommendations. Extends StrategyNodeUnionBase and inherits all of its fields.
| Field Name | Field Type | Description |
|---|---|---|
| field | StrategyNodeSortField | Required. Fields to sort on. |
StrategyNodeSortField
Defines the fields for sorting by StrategyNodeSort.
| 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:
|
StrategyNodeUnion
StrategyNodeUnion combines the output of all its child nodes. StrategyNodeUnion is a concrete implementation of StrategtNodeUnionBase and inherits all its fields.
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</RecommendationStrategy>