- 13 Sep 2024
- 2 Minutes to read
- Print
- DarkLight
19.1.6. Prompt Results Anywhere
- Updated on 13 Sep 2024
- 2 Minutes to read
- Print
- DarkLight
As the results from the AI are stored within Salesforce you’re able to take this data and populate it anywhere within Salesforce using the power of Salesforce Flows.
Below is a step-by-step guide on the Salesforce Flow you’ll need to create.
Create a new Record-Triggered Flow
Note this guide focuses the Reasoning field, but the same can also be done for the Rating field if you wish to push the value (out of 10) elsewhere, the field is Rating__c.
Create a new Record-Triggered Flow with the below configuration:
Object = AI Insight
Configure Trigger = A record is created or updated
Condition Requirements = All Conditions Are Met (AND)
Entry Conditions
Field = Reasoning__c
Operator = Does Not Equal
Value = {!$GlobalConstant.EmptyString}
When to run = Only when a record is updated to meet the condition requirements
Next, we’re going to look to filtering for a specific prompt:
Here is a breakdown of what this flow is doing exactly :
1. Get Prompt Configuration Object - this is to pull the configuration of the related prompt. This purpose of this is to pull the ID so we can then check it’s name within the decision maker to ensure it’s the prompt we want to action on.
Here, we’re fetching the AI prompt config object by using the ID field AI_Prompt_Configuration__c from the AI prompt object
2. Create a decision - Next you want to create a decision to filter for a specific prompt
Here we are using the Name field of the Configuration Object to check whether it’s the prompt we wish to act on.
In this example we have a prompt configured with the name ‘Customer Sentiment’ so within the conditions we look to match on the string ‘Customer Sentiment’ exactly.
Note: If you later change the name of your prompt you will need to ensure you amend your Flows to match it, otherwise your Flow will fail.
As the ‘Default Outcome’ will route on all AI prompt response which are not related to the ‘Customer Sentiment’ prompt, we can use an End element to simply stop the Flow.
3. Next, we decide how we want to take the response data and store it:
In this example we’re simply taking the results from the AI which are to do with prompt ‘Customer Sentiment’ and storing them against the Salesforce Contact the agent spoke with.
4. Get the Insight Object - First we need to find the Insight record which was associated with the AI prompt object, so we can extract the Call Reporting object.
5. Get Call Reporting Object - this is to pull information from the CRO record that’s related to the Insight record. The purpose of this is to pull the ID for the Contact we want to store the Reasoning on.
Note: If you want to store the Reasoning elsewhere (e.g. Account/Case/Custom Object), you’ll simply need to pull the ID for the related record you’d like to store the Reasoning on. You’ll need to make sure there’s a relationship between this object, and the Natterbox Call Reporting Object as well.
Here we’re using the UUID to find the correct Reporting record.
6. Find Contact - this is to find the related Contact stored on the CRO record.
7. Store the Reasoning on a new Field - now that we’ve been able to find the correct Call Reporting record and the correct related Contact, we can store the Reasoning here. In the below example, I’m storing the summary in a new field called Last Sentiment.
Note: If storing on a new field, you’ll need to make this a Text Area (Long) field.