Integrating with Salesforce CRM for Universal Consent & Preference Management
OneTrust's authentication process with Salesforce is changing. You can read more about these changes here.
Integrating OneTrust with Salesforce CRM allows organizations to ingest consent transactions through Salesforce contact records. This integration works by aligning the consent purposes and collection points set up in OneTrust with your Salesforce CRM database to create consent transactions when a new contact is added to your Salesforce database.
For more information on consent integrations from OneTrust to Salesforce, see Integrating with Salesforce Marketing Cloud for Universal Consent & Preference Management.
OneTrust Configuration Steps
To set up this configuration, you will need to complete Step 1: Gather OneTrust Consent Values within the OneTrust platform. You will need various consent values for the configuration within Salesforce.
Step 1: Gather OneTrust Consent Values
First you will need to locate and save information about your purposes, purpose preferences, and collection point from the OneTrust platform. These values will be used during the Salesforce configuration steps.
To obtain Purpose and Purpose Preference values
-
On the Universal Consent & Preference Management menu, select . The Purposes screen appears.
-
Click the name of the purpose you want to use for the integration. The Purpose details screen appears.
Note:If the purpose you want to use does not yet exist, you can add a new purpose. For more information, see Setting Up Purposes of Processing.
-
Copy and save the values from the Name and Purpose ID fields.
-
Click the Purpose preferences tab. If any purpose preferences are associated with the purpose, you will need to copy and save the name and ID values for each purpose preference and the name and ID of each available purpose preference option.
Value
Location
Purpose preference name
On the Purpose preferences tab, copy and save the values from the Name fields.
Purpose preference ID
On the Purpose preferences tab, copy and save the values from the ID field.
Purpose preference option name
-
On the Purpose preferences tab, click the link in the Name column for a purpose preference. The Purpose preference details screen appears.
-
Click the Options tab.
-
Copy and save the values from the Name column.
Purpose preference option ID
-
Navigate to the collection point you want to use for the integration. The Collection point details screen appears.
-
Click the Integrations tab.
-
In the Example payload section, locate the purpose preference ID. Then copy and save the IDs that appear under Options for the purpose preference. The order that the options IDs appear corresponds to the order that the option names are listed in the Purpose preference details screen > Options tab.
-
-
Repeat this process for each purpose you want to include in the integration.
To obtain Collection Point values
Your collection point must contain all of the purposes for which you want to gather consent.
-
On the Universal Consent & Preference Management menu, select . The Collection points screen appears.
Note:A Custom API type collection point is required for this integration.
-
Click the name of the collection point you want to use for the integration. The Collection point details screen appears.
Note:If the collection point you want to use does not yet exist, you can add a new collection point. For more information, see Managing Collection Points.
-
Click the Integrations tab.
-
Copy and save the values from the Your API URL and Your API token sections.
Salesforce Configuration Steps
OneTrust recommends using the Salesforce Classic interface to configure this integration.
This guide is not intended to be a comprehensive guide to the configuration of Salesforce. The Salesforce interface may have changed since the time of this writing. For more information, consult the documentation provided by your Salesforce administrator.
The remaining steps of this configuration are completed in Salesforce. You will need access to the following in Salesforce:
-
Remote Site Settings
-
Field customization for data subjects/contact records
-
Developer Console
Step 1: Add Endpoint URLs to Remote Site Settings
In this step, you will add the Consent Receipt API URL to Salesforce: https://privacyportal[env].onetrust.com.
-
In Salesforce, click the gear icon in the header and select Setup. The Setup Home screen appears.
-
On the side menu, select . The All Remote Sites screen appears.
Note:Alternatively, you can enter Remote Site Settings in the Quick Find field.
-
Click the New Remote Site button. The Remote Site Edit screen appears.
-
Complete the fields, as needed. In the Remote Site URL field, paste the Your API URL value that you copied from the collection point.
Note:Alternatively, you can enter https://privacyportal[env].onetrust.com and replace
[env]with the name of the environment where your OneTrust platform is hosted.Your OneTrust platform environment can be identified by referencing the URL that you use to log in to the platform. For example, if you log in to OneTrust at app.onetrust.com, then your environment name would be
app. -
Click the Save button.
Step 2: Create a Custom Field for the Data Subject Identifier
If you are using a data subject identifier that is not already a field in your contact records, you will need to create a new custom field.
-
In Salesforce, click the gear icon in the header and select Setup. The Setup Home screen appears.
-
On the side menu, select . The Global Data Manager screen appears.
-
In the Quick Find field, enter Contact. Then locate and click the link for the Contact object. The Details screen appears.
-
On the side menu, select Fields & Relationships. The Fields & Relationships screen appears.
-
Click the New button. The New Custom Field screen appears.
-
In Step 1. Choose the field type, select Text in the Data Type field. Then click the Next button.
-
In Step 2. Enter the details, complete the fields. Then click the Next button.
-
In Step 3. Establish the field-level security, set the visibility permissions for the field by selecting the profiles that should have edit or read-only access to the field. Then click the Next button.
-
In Step 4. Add to page layouts, select the page layouts on which the custom field should appear.
-
Click the Save button. The Fields & Relationships screen reappears.
-
In the Quick Find field, enter the name for the new custom field you created. Then locate and click the link for the custom field. The Contact Custom Field screen for the custom field appears.
-
Copy and save the API Name value of the new custom field.
Step 3: Create a Custom Field for Purpose 1 and Purpose 2
If you are using a purpose that is not already a field in your contact records, you will need to create a new custom field.
In the default configuration of the integration, purpose 1 comes with three purpose preferences options. The simplest process would be to create three custom fields, one for each purpose preference option.
-
In Salesforce, click the gear icon in the header and select Setup. The Setup Home screen appears.
-
On the side menu, select . The Global Data Manager screen appears.
-
In the Quick Find field, enter Contact. Then locate and click the link for the Contact object. The Details screen appears.
-
On the side menu, select Fields & Relationships. The Fields & Relationships screen appears.
-
Click the New button. The New Custom Field screen appears.
-
In Step 1. Choose the field type, select Checkbox in the Data Type field. Then click the Next button.
-
In Step 2. Enter the details, complete the fields and select Unchecked in the Default Value field. Then click the Next button.
-
In Step 3. Establish the field-level security, set the visibility permissions for the field by selecting the profiles that should have edit or read-only access to the field. Then click the Next button.
-
In Step 4. Add to page layouts, select the page layouts on which the custom field should appear.
-
Click the Save button. The Fields & Relationships screen reappears.
-
In the Quick Find field, enter the name for the new custom field you created. Then locate and click the link for the custom field. The Contact Custom Field screen for the custom field appears.
-
Copy and save the API Name value of the new custom field.
-
Repeat this procedure for all purpose preference options for purpose 1.
-
Repeat this procedure for purpose 2.
Note:By default, purpose 2 does not hold any purpose preferences. Therefore, creating one custom field checkbox is sufficient.
Step 4: Create a Custom Field for Purpose 3
If you are using a purpose that is not already a field in your contact records, you will need to create a new custom field.
-
In Salesforce, click the gear icon in the header and select Setup. The Setup Home screen appears.
-
On the side menu, select . The Global Data Manager screen appears.
-
In the Quick Find field, enter Contact. Then locate and click the link for the Contact object. The Details screen appears.
-
On the side menu, select Fields & Relationships. The Fields & Relationships screen appears.
-
Click the New button. The New Custom Field screen appears.
-
In Step 1. Choose the field type, select Picklist (Multi-Select) in the Data Type field. Then click the Next button.
-
In Step 2. Enter the details, select Enter values, with each value separated by a new line. Then enter the names defined in the OneTrust platform for the purpose preference options linked to purpose 3. Then click the Next button.
-
In Step 3. Establish the field-level security, set the visibility permissions for the field by selecting the profiles that should have edit or read-only access to the field. Then click the Next button.
-
In Step 4. Add to page layouts, select the page layouts on which the custom field should appear.
-
Click the Save button. The Fields & Relationships screen reappears.
-
In the Quick Find field, enter the name for the new custom field you created. Then locate and click the link for the custom field. The Contact Custom Field screen for the custom field appears.
-
Copy and save the API Name value of the new custom field.
Step 5: Create the Apex class OT_consentData
The following procedure requires the OT_consentData.apxc file that can be downloaded from Apex Files for Salesforce CRM Integration.
-
In Salesforce, click the gear icon in the header and select Developer Console. The Developer Console screen appears.
-
On the File menu, select . The New Apex class modal appears.
-
Enter OT_consentData as the name of the Apex class and click OK.
Note:If you use a different name, you will need to update the value copied over from the OT_consentData.apxc file.
-
Download the OT_consentData.apxc file and open it using a text editor.
-
Copy and paste this text into the Developer Console.
Note:If there is any pre-populated text in the console, delete it before pasting.
-
In the
getPurpose1,getPurpose2, andgetPurpose3classes, replace the names and IDs with the names and IDs of the purposes and purpose preferences pulled from OneTrust in Step 1: Gather OneTrust Consent Values. For more information on this process, see the detailed comments available within the OT_consentData file.Note:If you are only collecting consent for one purpose, delete or comment out the unused getPurpose[number] classes.
-
Replace the value of
requestInformationwith the Your API token value of the collection point pulled from OneTrust in Step 1: Gather OneTrust Consent Values. -
On the File menu, select Save.
Step 6: Create the OneTrust Consent Trigger
The following procedure requires the OT_consentTrigger.apxt file that can be downloaded from Apex Files for Salesforce CRM Integration.
-
In Salesforce, click the gear icon in the header and select Developer Console. The Developer Console screen appears.
-
On the File menu, select . The New Apex Trigger modal appears.
-
In the Name field, enter OT_consentTrigger.
Note:If you use a different name, you will need to update the corresponding value copied over from the OT_consentTrigger.apxt file.
-
In the Object field, select the object that will be used to track consent, such as Contact.
-
Download the OT_consentTrigger.apxt file and open it using a text editor.
-
Copy the text and paste it into the Developer Console.
Note:If there is any pre-populated text in the console, delete it before pasting.
-
Replace each instance of
<SFDC_Data_Subject_Identifier_Field_Name>with the API Name value of the custom field you created for the data subject identifier in Step 2: Create a Custom Field for the Data Subject Identifier. -
Replace each instance of the placeholders starting with
<SFDC_...>with the API Name value of the custom fields you created for the purpose and purpose preferences in Step 3: Create a Custom Field for Purpose 1 and Purpose 2. Detailed comments are available within the OT_consentTrigger.apxt file. -
Replace each instance of
<OT_...>with your OneTrust purpose and purpose preference names defined in the OT_consentData class.Note:If you are only collecting consent for one or two purposes, delete the unused If statements.
-
On the File menu, select Save.
Step 7: Create the Apex class OT_Error_Exception
The following procedure requires the OT_Error_Exception.apxc file that can be downloaded from Apex Files for Salesforce CRM Integration.
-
In Salesforce, click the gear icon in the header and select Developer Console. The Developer Console screen appears.
-
On the File menu, select . The New Apex class modal appears.
-
Enter OT_Error_Exception as the name of the Apex class and click OK.
Note:If you use a different name, you will need to update the value copied over from the OT_Error_Exception.apxc file.
-
Download the OT_Error_Exception.apxc file and open it using a text editor.
-
Copy the text and paste it into the Developer Console.
Note:If there is any pre-populated text in the console, delete it before pasting.
-
On the File menu, select Save.
Step 8: Create the Apex class OT_consent_CallOut
The following procedure requires the OT_consent_CallOut.apxc file that can be downloaded from Apex Files for Salesforce CRM Integration.
-
In Salesforce, click the gear icon in the header and select Developer Console. The Developer Console screen appears.
-
On the File menu, select . The New Apex class modal appears.
-
Enter OT_consent_CallOut as the name of the Apex class and click OK.
Note:If you use a different name, you will need to update the value copied over from the OT_consent_CallOut.apxc file.
-
Download the OT_consent_CallOut.apxc file and open it using a text editor.
-
Copy the text and paste it into the Developer Console.
Note:If there is any pre-populated text in the console, delete it before pasting.
-
Replace
ENVin'https://privacyportal<ENV>.onetrust.com/request/v1/consentreceipts'with the name of the environment in which your OneTrust account is hosted.Note:Your OneTrust platform environment can be identified by referencing the URL that you use to log in to the platform. For example, if you log in to OneTrust at app.onetrust.com, then your environment name would be
app. -
On the File menu, select Save.
Additional Information
Any time a new purpose is added to the collection point in the OneTrust platform, the following updates are needed:
-
Create new custom fields for the purpose(s). For more information, see Step 3: Create a Custom Field for Purpose 1 and Purpose 2.
-
Update the OT_consentData.apxc file with the new purpose(s). For more information, see Step 5: Create the Apex class OT_consentData > OT_consentData.
-
Update the OT_consentTrigger.apxt file with the new field(s) / purpose(s). For more information, see Step 6: Create the OneTrust Consent Trigger.