Site icon UnofficialSF

Adding $User and $Request to NBA Strategies

Adding $User and $Request to NBA Strategies

In addition to $Record, which is described here, there are two other system variables that can be used in Next Best Action.

$User

This provides access to the recordId of the logged in Salesforce user that is generating the request. For example if you set up a Branch Select expression as $User.Division or $User.Department being equal to or not equal to a certain string, the recommendations will vary depending on the user. This is highly relevant for Community Cloud use cases, where you often don’t have record pages where $Record can be used.

$Request

Requests arrive at the Next Best Action strategy engine via a REST API call. When you use the Next Best Action or Suggested Actions (Community Cloud) components that come with Salesforce, this call is made by the component. However, if the request is made from a custom source, parameters can be passed in that are then accessible in the strategy.

Users cannot currently declaratively customize their instances of the component to provide custom request parameters, but there are two cases where Salesforce does this internally. In these cases, parameter values $Request.search, $Request.subject and $Request.description are passed to the engine and can be used by strategies. (Learn more about special Community Cloud support here.)

If you are calling Next Best Action programmatically, you can freely pass in parameters of this type.

Skip to toolbar