Skip to main content
Gainsight Inc.

Update Contacts with Email Opt-Out Configurations


This article explains the process of updating Contacts with Opt-out configurations. Opt-out settings refer to the email communications from Gainsight which a customer has opted not to receive.


This section describes the high level steps involved in creating an Opt-Out rule.

  1. The Contact object must be updated with a new custom field Opt-Out Category. This custom field stores the category of email for which the customer has opted out of.
  2. After creating the custom field, a rule is created using two datasets.
  3. The first dataset is created on the  Email Logs object and fetches the list of customers who have opted out of emails from Gainsight.
  4. The second dataset is created on the Opt-Out Email object which determines the category of mail for which the contact has opted-out.
  5. The Load to SFDC Objects action type will be used to Load this data to the Contacts object.

Create Custom Object

This section describes the process of creating a custom field in the Contact object.

To add a custom field:

  1. Navigate to Setup.
  2. Type Contact in the search bar.
  3. Click the Fields button under the Contacts menu.
  4. Scroll down to Contact Custom Fields & Relationships and click New.

1. created.gif

  1. Select Text as the Data type and click Next.
  2. Enter a name and specify the length of the field and click Next.
  3. Click Next.
  4. Click Save.


Create First Dataset

This dataset is created on the Email Logs object and determines if a customer has opted out of emails.

  1. Navigate to Administration > Rules Engine.
  2. Click Create Rule.
  3. Enter the following details:
    1. Rule For: Account.
    2. Rule Name: Enter a name.
    3. Folder: Select a folder for the rule.
    4. (Optional) Description: Enter a description for the rule.
    5. Click NEXT.


  1. Click DATASET.
  2. Select Matrix Data as the source
  3. Select the Email Logs object.
  4. Drag and drop the following fields to the Show section.
  • Id
  • Unsubscribed
  • Account Name
  • Account Id
  • Unsubscribed On
  • Contact Name
  • Contact Id
  • Email Address
  1. In the Filters section, select the Unsubscribed On field and set the value to less than or equal to the Rule Date. This filter extracts the records that are unsubscribed on or before the rule is run.


  1. Click SAVE.
  2. Click <-.

Create Second Dataset

This dataset is created on the Opt-Out Emails object and determines the category of emails, for which the customer has opted out of.

  1. Click + TASK and select Dataset.
  2. Select Matrix Data as the source.
  3. Select Opt-Out Emails as the source object.

6. Select 2nd dataset.gif

  1. Drag and drop the following fields to the Show section.
  • Email Log Id
  • Company Id
  • Email Address
  • Category Id:: Code


  1. Click SAVE.
  2. Click <-.

Create Merge Task

This task combines the above datasets based on the Email log Id and Email Address fields.

  1. Click + TASK and select Merge.
  2. Enter a Task name.
  3. Select both the Datasets.
  4. Select Retain common records from both datasets as merge type.  
  5. Select Id field from Email Logs object and Email Log Id field from Opt-Out Emails object as matching criteria for join.
  6. Select Email Address from both the objects as matching criteria.

8. Opt-out_merge.gif

  1. Ensure that the output field headers from both the datasets are unique.
  2. Click SAVE.

9. Merge configure.gif

Setup Rule Action

This section describes the process of setting up the Load to SFDC Action Type. The data fetched is loaded to the Contact object.

  1. Click the Settings icon and select Permissions - Rules Load Actions
  2. Ensure that the Contact object is selected and all its fields are located under the Selected Fields column.
  3. Click SAVE and click BACK.


  1. Click Setup Action.
  2. Click + ACTION and select the merge task.
  3. Select Load to SFDC Object as action type.
  4. Select Contact in the Object Name field.
  5. Select Upsert as the operation type.

11. Opt-out111.gif

  1. Map the Contact Id field to Id field and select this mapping as identifier.

12. Map Id.gif

  1. Map the Category Id Code field with the newly created custom object Opt-Out Category field.
  3. Map the Email Opt Out (Boolean) field from the right column.
  4. Set the toggle button to TRUE in the left pane
  5. Click SAVE.

13. Mappings.gif

For more information on how to schedule an execution of this rule, if required, refer to the Scheduling Rules article.