- 13 Nov 2024
- 2 Minutes to read
- Print
- DarkLight
Example 3: Consent Management Part I
- 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 3 Goals
In this example, we will monitor inbound Relay events looking for TCPA consent changes. If a we receive a consent change event from Relay, we will try and locate the matching Person Account and update it’s consent value - only if it has changed.
IMPORTANT
TCPA consent is to a mobile number not an individual person. This example assumes your backend rules only allow a mobile number to be associated with a single Person Account. If this is not the case, then instead of looking for a single Person Account by the Relay CCID, you should instead look for all Person Accounts that match the mobile number and update each record with the new consent value.
Assumptions
The Relay Connected App has been configured. This is required to receive push events from Relay.
TCPA consent is stored in a Person Account record in a custom field called HasConsentedToSMS__c.
The Person Account has a custom field, RelayCCID__c, that holds the unique ID of the user.
HasConsentedToSMS__c is of type checkbox
We will leverage a custom flow resource, ConsentMapping, to convert the Relay consent values to our internal consent value which is a simple checkbox.
Flow Resources
For this example, the following flow resources are required.
Resource | Type | Description |
---|---|---|
ConsentMapping |
| This resource is used to map the Relay Consent values to the consent values of our business. For this example the business assume a logical consented or not consented (e.g. checkbox). The below formula will return True when the Relay Consent value is either written or express and will return False if the consent value is stop
|
Flow Logic
(1) Configure 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:
Conditions Requirements set to All Conditions Are Met (AND)
Field → EventType__c → Equals → channel_consent
Field → EventSubType__c → Equals → update
(2) Get the Person Account
Try and locate the Person Account that is related to the Relay Event record, identified by the CCID value. As an additional optimization, we will only return the found record if its consent value is different from the Relay Event record.
Add a Get Records action
Set the Filter Account Records Condition Requirements as follows:
Condition Requirements set to All Conditions Are Met (AND)
Field → RelayCCID__c → Equals → $Record > RelayCCID
Field → HasConsentedToSMS__c → Does not Equal → ConsentMapping
(3) Check for a Found User
Add a Decision element
Add an Outcome that verifies the record was found
Resource → {!Get_Record_From_CCID} → Is Null → False
(4) If Found, Update the Person Account
If found, update the Person Account record’s consent field checkbox with the new value from the Relay Event.
Set Variable Values as follows:
{!Get_Record_From_CCID.HasConsentedToSMS__c} → Equals → ConsentMapping
(5) Update the Person Account
Add an Update Records element to commit the Person Account changes.