Skip to main content
Gainsight Inc.

Onboarding: Rules Engine: New Customer Sync

This article walks you through how to use the Rules Engine to sync customers within Salesforce to Gainsight along with customer attributes. If you need additional information, see Initial Rule Setup.

New Rule #1: Import New Customers from Account

  1. Navigate to Administration > Rules Engine.
  2. Click + RULE.
  3. Select the Custom rule type.
  4. Create the rule for an Account.
  5. Provide a name for the rule in Rule Name box.
  6. Provide a detailed description of the rule in Description box.
  7. Click NEXT.

clipboard_e8a5a234da38d3ef3853e8295ce5fb4e9.png

Setup Rule

Setup Rule

  1. Select Account as the Source Object. In this example, new customers are going to be created from the Account object. You can create Gainsight customer records from other objects as well, such as Opportunity, Subscription, and so on.
  2. In the Show section, add Account:: Id so that you can map it to the correct account in the Setup Action step. You can choose additional fields that you would like to map from Salesforce to the Gainsight CustomerInfo object. Examples include MRR, ARR, Renewal Date, and so on. For this particular example, we map Account::ARR with Account::MRR.
  3. In the Filters section, add Account:: Account Type includes Customer - DirectCustomer - Partner and Account::Customer Info equals Null. This will ensure that only new customers are imported. Note: You may choose to filter based on another Account or Opportunity field such as Opportunity Status = Closed Won.
  4. Clear the Apply to Gainsight customers only box, as you want to be able to create new and update existing records.

Setup Action

Setup Action

For this step we will import the New Customers based on the filter criteria from the previous step. The Load to Customers action performs an insert, meaning it both inserts new customers and updates existing customers.

  1. Click + ACTION.
  2. Select Load to Customers as Action Type.
  3. In the Field Mappings section, you can see the fields from the previous screen:
    • Map Account ID to Account (String).
    • In this example, map the ARR to ASV and MRR to MRR, these are standard Customer fields that are used in Gainsight.
  4. Click + Add Field Mapping to choose additional mappings within Gainsight. In this example, we have added Status so that when customers are added to Gainsight using this rule, they have a Status of Active. Note that Status is a required field in Gainsight, so this is a required step.

Schedule

Schedule

  1. Run the rule daily so that new customers are moved into Gainsight on the same day.
  2. Select a Start Date and End Date (optional).
  3. Select a Preferred Start Time. Note that subsequent rules will run after this one (New customer alerts, and so on). Also, ensure you do not schedule anything from or to the same object at the same time, because this will cause the rules to fail.
  4. Click Start to confirm the schedule.

New Rule #2: Sync Updated Customer Data

clipboard_ec918ae09e28e739a27bef2b410fc68cf.png

  1. Click + RULE.
  2. Select the Custom rule type.
  3. Create the rule for an Account.
  4. Provide a name for the rule in Rule Name box.
  5. Provide a detailed description of the rule in Description box.
  6. Click NEXT.

Setup Rule

Setup Rule

  1. Select Account as the Source Object. In this example, new customers are going to be created from the Account object. You can create Gainsight customer records from other objects as well, such as Opportunity, Subscription, and so on.
  2. In the Show section add Account:: Id so that you can map it to the correct account in the Setup Action step. You can choose additional fields that you would like to map from Salesforce to the Gainsight CustomerInfo object. Examples include MRR, ARR, Renewal Date, and so on. For this particular example, we map Account::ARR with Account::MRR.
  3. In the Filters section, add Account:: Account Type includes Customer - Direct. This will ensure we are only grabbing active customers. Note: You may choose to filter based on another Account or Opportunity field such as Opportunity Status = Closed Won.
  4. Select the Apply to Gainsight customers only box, as you want to update existing records.

Setup Action

Setup Action

For this step we will be updating Existing Customers, so again we'll use the Load to Customers action because this performs an upsert, meaning it both inserts new customers and updates existing customers.

  1. Click + ACTION.
  2. Select Load to Customers as the Action Type.
  3. In the Field Mappings section, map Account ID to Account (String). In this example we are also mapping the ARR to ASV and MRR to MRR, which are standard Customer fields that are used in Gainsight.
  4. Click + Add Field Mapping to choose additional mappings within Gainsight. In this example, we added Status so that when customers are added to Gainsight using this rule they have a Status of Active. Note that Status is a required field in Gainsight so this is a required step.

Schedule

Schedule

Choose how often and when this rule should run. Because this rule is running an update on customers, we want this to run after the new customer rule.

  1. Run the rule daily.
  2. Select a Start Date.
  3. (optional) Select an End Date.
  4. Select a Preferred Start Time. Note that many subsequent rules will be running after this one (New customer alerts, etc).Also, ensure you do not schedule anything from or to the same object at the same time, because this will cause the rules to fail.
  5. Click Start to confirm the schedule.

New Rule #3: Import Customer Data from the Opportunity Object

  1. Click + RULE.
  2. Select the Custom rule type.
  3. Create the rule for an Account.
  4. Provide a name for the rule in Rule Name box.
  5. Provide a detailed description of the rule in Description box.
  6. Click NEXT.

clipboard_e51d76394b9fb2297c2bdeba663c6c515.png

Setup Rule

Setup Rule

  1. Select Opportunity as the Source Object. You could also create new customers from another object that contains customer data and is linked directly to the Account object.
  2. Add Account:: Id in the Show field. You can choose additional fields that you would like to map from Salesforce to the Gainsight CustomerInfo object. Examples include MRR, ARR, Renewal Date, and so on. For this particular example, we are adding the SUM of the Opportunity::Subscription ARR and Opportunity::Subscription MRR.
  3. In the Filters section, filter based on {Opportunity:: Stage - equals - Closed Won}{Opportunity::Close Date | greater or equal to | Subtract N Days from Rule Date | 365} and {Opportunity::Close Date | less or equal to | Rule Date}. This  ensures we are only syncing closed opportunity amounts in the past year.
  4. Select the Apply to Gainsight customers only box, since we are only syncing customers into Gainsight and not inserting new customers.

Setup Action

Setup Action

For this step we will be updating Existing Customers, so again we'll use the Load to Customers action because this performs an upsert, meaning it both inserts new customers and updates existing customers.

  1. Click + ACTION.
  2. Select Load to Customers as Action Type.
  3. In the Field Mappings section, map Account ID to Account (String). In this example, we also map the Sum of Subscription ARR to ARR and Sum of Subscription MRR to MRR, which are standard Customer fields in Gainsight.

Schedule

Schedule

Since this rule is updating existing customers with new information, you will want to schedule this to run after the new customer import rule.

  1. Run the rule daily.
  2. Select a Start Date.
  3. Select Preferred Start Time. Note that many subsequent rules will run after this one (like new customer alerts). Also, ensure you do not schedule anything from or to the same object at the same time, because this will cause the rules to fail.
  4. Click Start to confirm the schedule.

New Rule #4: Move Churned Customers to Churn

  1. Click + RULE.
  2. Select the Custom rule type.
  3. Create the rule for an Account.
  4. Provide a name for the rule in Rule Name box.
  5. Provide a detailed description of the rule in Description box.
  6. Click NEXT.

clipboard_eb5f28d2e153ad4c456763a0831f17a04.png

Setup Rule

Setup Rule

  1. Select Account as the source object. Alternatively, you could also create new customers from the Opportunity object or another object that contains customer data and is linked directly to the Account object.
  2. In the Show section, add Account:: Id so that you can map it to the correct account in the Setup Action step. If necessary, you can choose additional fields that you would like to map from Salesforce to the Gainsight CustomerInfo object.
  3. In the Filters section, filter based on {Account::Customer Stage - equals - Churn}. This will ensure we are only syncing churned accounts.
  4. Select Apply to Gainsight customers only box, as we are only syncing customers into Gainsight and not inserting new customers.

Setup Action

Setup Action

For this step we will be updating Existing Customers, so we'll use the Load to Customers action because this performs an upsert, meaning it both inserts new customers and updates existing customers.  

  1. Click + ACTION.
  2. Select Load to Customers as Action Type.
  3. In the Field Mappings section, map Account ID to Account (String).
  4. In the Add Field Mappings section, add Status and mark as Churn.
  5. (optional) You may also decide to set different customer data points to zero. In this example, we changed the ARR & MRR to zero to show this account no longer contributes any $$.

Schedule

Schedule

  1. Run the rule daily, so that existing customers are updated daily in Gainsight.
  2. Select a Start Date.
  3. Select a Preferred Start Time. Note that many subsequent rules will be running after this one (like new customer alerts).Also, ensure you do not schedule anything from or to the same object at the same time because this will cause the rules to fail.
  4. Click Start to confirm the schedule.
  • Was this article helpful?