Site icon UnofficialSF

Using Next Best Action with Salesforce Connect

Using Next Best Action with Salesforce Connect

To use External Object/Salesforce Connect in a Strategy there are a couple of steps you need to follow.

Set up external data source

  1. To set up an OData backed ExternalObject follow steps under “Connect an External Data Source” in the Trailhead
  2. To set up a Custom Apex backed External Object you need to follow the steps here: Set Up Salesforce Connect to Access External Data with a Custom Adapter.
    • Apex classes are created in setup under “Apex Classes”
    • Here you can find example DataSource.Connection and DataSource.Provider classes with hardcoded data: Custom Apex data source example.

Reference the external data from the context object

  1. Create a custom field on the context entity (e.g. Case).
    1. Go to Setup -> Object Manager -> Case -> Field & Relationships
    2. Add an external lookup field to your external data
    3. Remember the name of the field as you’ll need it in your strategy definition below.
  2. Populate the new field on your context objects
    1. Go to each of the records (e.g. Cases) you want to use and populate the field with the ExternalId of the External Objects in the data source you’re using.
    2. You can find the ExternalId either by creating a tab for the externa object and checking in the UI or easier by querying through soql in workbench:
      SELECT ExternalId FROM <ExternalObjectName>__x

Reference the external data from a Recommendation

This is done in the same way as referencing the external data from the context object but you add the external lookup field to the Recommendation entity instead of the Case.

Use the external data in your strategy’s Filter and Branch Select nodes

Format:

$Record.<ContextLookupField>__r.<ContextDataField>__c == <PropositionLookupField>__r.<PropositionDataField>__c

Where

Note 1: If the external data is more appropriate on some parent object of your context object, e.g. the Contact of the Case, if it is data about the customer, then you add the external lookup field on the Contact object. Then you access it like this instead: $Record.Contact.<ContextLookupField>__r.<ContextDataField>__c

Note 2: You can also use the external object directly as the context object in which case you access it like this instead:

$Record.<ContextDataField>__c

Note 3: The process its the same for custom objects. Just skip the external data source setup and use a lookup field instead of a external lookup field.

Exit mobile version
Skip to toolbar