--- title: "Example 4: Consent Management- SF to Relay" slug: "example-4-consent-management-part-ii" updated: 2024-11-13T15:31:28Z published: 2024-11-13T15:31:28Z canonical: "docs.relaynetwork.com/example-4-consent-management-part-ii" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.relaynetwork.com/llms.txt > Use this file to discover all available pages before exploring further. # Example 4: Consent Management- SF to Relay NOTE 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. In this example, we will send any TCPA consent changes made to the user record in Salesforce to the Relay SaaS platform. This ensures that the user’s consent value is synchronized with Relay. > [!NOTE] > NOTE > > TCPA states that consent is to the mobile number. Therefore, we only need to pass the mobile phone number and new consent value to Relay. We do not need to pass the CCID. ### Assumptions - TCPA consent is stored in a *Person Account* record in a custom field called *HasConsentedToSMS__c* and is of type *checkbox.* - We will leverage a custom flow resource, *ConsentMapping*, to convert *HasConsentedToSMS__c* boolean value to a valid Relay consent values. ### Flow Resources | Resource | Type | Description | | --- | --- | --- | | ConsentMapping | - Resource Type → **Formula** - Data Type → **Text** | This resource is used to map the *HasConsentedToSMS__c* boolean value to a valid Relay consent value. The below formula will return **Express** when the *HasConsentedToSMS__c* has been checked otherwise, it returns **Stop**. ```plaintext IF({!$Record.HasConsentedToSMS__c}, "Express", "Stop") ``` | ### Flow Logic ![rn-sfdc-flows-ex4-diagram](https://cdn.us.document360.io/6738087b-455d-402f-b70a-a44a4231547e/Images/Documentation/rn-sfdc-flows-ex4-diagram.png) ### (1) Configure The Start Element - Create a **Record-Triggered Flow** on the **Account** record type - Set the *Configure Trigger* to **A Record is Updated** - Set the following *Entry Conditions:* - Conditions Requirements set to **All Conditions Are Met (AND)** - Field → **HasConsentedToSMS__c → Is Changed → True** ![rn-sfdc-flows-ex4-1-trigger](https://cdn.us.document360.io/6738087b-455d-402f-b70a-a44a4231547e/Images/Documentation/rn-sfdc-flows-ex4-1-trigger.png) ### (2) Add the RelayConsentAction Element - Add a new **Action** element - Search for **RelayConsentAction** and select it - Set the **RelayConsentAction** Input Values as follows: - *Send via Future →* **{!$GlobalConstant.False}.** Because we are executing in the asynchronous branch we are technically already in a future that is why we can set this value to **False**. - *Mobile Phone →* **{!$Record.PersonMobilePhone}.** - *New Consent* → **{!$ConsentMapping}.** We use our resource formula to map our internal consent value to a valid Relay consent value. ![rn-sfdc-flows-ex4-2-relay_callout](https://cdn.us.document360.io/6738087b-455d-402f-b70a-a44a4231547e/Images/Documentation/rn-sfdc-flows-ex4-2-relay_callout.png) ### (3) Add a Decision Element Add a *Decision* element to check the status of the *RelayConsentAction* callout. If the callout fails, you should add the appropriate action to inform your team of the issue. ![rn-sfdc-flows-ex4-3-decision](https://cdn.us.document360.io/6738087b-455d-402f-b70a-a44a4231547e/Images/Documentation/rn-sfdc-flows-ex4-3-decision.png) Telephone Consumer Protection Act (TCPA) requires that the recipient of the SMS (your customers) must grant permission for you to send them text messages