- 13 Nov 2024
- 2 Minutes to read
- Print
- DarkLight
Example 2: Create a Case on Low NPS
- Updated on 13 Nov 2024
- 2 Minutes to read
- Print
- DarkLight
This example should be used as a reference to understand basic concepts and ideas on integrating with Relay Network. It should not be taken literally as this is how integration to Relay must be done. You should replace your record types, field names, business logic, etc. with those that match your business process and setup.
Example Goals
In this example, we will monitor user responses (from the Relay Feed) related to our Company’s NPS. User responses, from the Feed, arrive as events and are stored in the RelayEvents__c custom object. If the user responds with a poor rating, we will create a new Salesforce case for a follow up with the user.
Assumptions
The Relay Connected App was configured to allow Relay to push RelayEvent__c record to your Salesforce org.
A Relay message was sent to a specific Person Account’s Relay Feed.
The Person Account has a custom field, RelayCCID__c, that hold the unique CCID value for the user.
The Relay message allows the user to click on a Feed action to rate the Company.
Security and Permissions
Record triggered flows always run as the System Context without Sharing. This provides access to all objects and their fields.
Flow Resources
Resource Name | Type | Description |
---|---|---|
NewCase | Resource Type → Variable Data Type → Record Object → Case | If the trigger conditions are met, this resources will be populated with details and submitted to the |
Flow
(1) Configure the Start Element
The majority of the flow logic all happens in the Start Element.
Create a Record-Triggered Flow on the RelayEvents__c record type
Set the Configure Trigger to A Record is Created
Set the following Entry Conditions:
Condition Requirements → All Conditions Are Met (AND)
Field → TriggerID__c → Equals → Provide a valid Relay Trigger ID value corresponding to the correct Relay Message.
Check that the EventType__c field refers to an experience action.
Check that the ActionLabel__c field refers to Poorly, which indicates the user is unhappy with us.
It is generally a good idea to put the this type of flow logic in a Run Asynchronously Path ensuring the RelayEvent__c record is always created.
(2) Add a Get Records Element
Locate the Person Account record using the CCID from the triggered event record.
(3) Verify Person Account was Found
Add a Decision element to verify the record was located.
(4) Create a new Case Record
If we found the matching record, we will create a new Case and assign to the located record.
Add an Assignment element to the flow
Populate the NewCase resource with the appropriate field values.
(5) Create the new Case Record
Add a Create Records element to the flow
Specify the NewCase resource as the record to be created.