Tutorial Overview

Subject: This tutorial demonstrates one example for which the Rules Engine can be used to perform field comparisons to trigger certain actions.  
Scenario:
  • Customer wants a CTA to be created when a CSM assignment changes
  • The CTA will assist with Account Transition to the newly assigned CSM (via a Playbook)
Complexity: Medium
Description: Employ a custom field to allow field comparisons upon update
Challenges: In Enterprise-Level organizations, this may require interaction with the organization's Salesforce administrator
Approach:
  1. Create new Custom Field in SFDC
  2. Create a Rule to copy/push values each day
  3. Create another rule which performs the comparison and create a CTA

Notes and Tips

General:

  • This tutorial is presented for educational purposes only
  • Always test your rules before running them in a production environment
  • Understand your Salesforce environment before performing any operations which may affect your data

Salesforce.com Data

  • Data within Salesforce.com (SFDC) is "Present State"
  • This means that you cannot implicitly detect changes in SFDC data without leveraging additional means
  • This tutorial requires custom fields within SFDC to perform the comparison

Field Types

  • Field comparison requires that fields be of the same type
  • Comparisons made between different types of fields will produce no results

Updating Fields in Salesforce.com (SFDC)

CAUTION:  When using the "Load to SFDC Object", you can potentially overwrite data! Test all rules before running them in a production environment.

Step 1 - Create Custom Field in SFDC

Create a new Custom Field within SFDC to use for comparison:

  1. Click "Setup" within SFDC and navigate to Customize > Accounts > Fields
  2. Create a new Custom Field:
    • Field Label:  CSM Old
    • Data Type:  Lookup (User)
    • Field Name: CSM_Old
    • Description: "This field will be used to capture changes to CSM Assignments and be populated by a Gainsight Rule"
  3. Step through each screen
    • Security, etc
  4. Click "Save" to save the Custom Field

Step 2 - Create Rule to Push Old CSM Value to Custom Field

Once a Custom Field is created properly within SFDC, we create the first of two rules below.

Step 2a - Create New Rule

In this step, we create a new rule “Admin - CSM Change - Push Old CSM Value”


Step 2b - Add Fields

From the Account Object, drag the following fields into the "Show" box:

  • Account::Id
  • Account::CSM - This stores the current value of the CSM
  • Account::CSM Old - Account:: CSM Old is the field we just created that will store the copied value of the Account:: CSM field.

Once you have these selected, click the gear icon at the top right of the screen and proceed to the next step.

Step 2c - Select SFDC Fields to Load

By selecting the gear within the "Setup Rule" page, you access the "Data Load Configuration" page.  You can read more about this in the USE RULES TO LOAD TO SFDC OBJECT OR MDA SUBJECT AREA article.

Select the fields:

  • CSM :: USERLOOKUP
  • CSM Old :: USERLOOKUP

This give access to the CSM and CSM Old fields within field mappings within the next step.

Step 2d - Create a "Load to SFDC Object" Action with Field Mapping

Create a new Action:

  1. Select the "Load to SFDC Object" Action
  2. Select the "Account" Object Name
  3. For Operation - select "Update"
  4. Select +Field Mapping and add the following fields:
    • Account ID - Check the "Include in Identifiers" checkbox
    • Account:: CSM - Mapp to CSM Old
  5. Select +Criteria and select Account::CSM Old not equal to Account::CSM
    • This only selects fields for which there is a difference, reducing the total number of updates
  6. Click Save and proceed to the next step

Step 2e - Test

Test your rule to ensure that records are correctly copied from the "CSM field" to the "CSM Old" field.  

  1. Click the "Run Now" button
  2. For a test run, check the box adjacent to "No actions will be performed ..."
  3. Select "Run"

NOTE: On your first run, all records will be updated. On subsequent runs, only fields which have changed will be updated.  

When you are satisfied that the rule will run correctly, you may run again and update records.

Step 3 - Create Rule to Compare Field and Create CTA

In this step, you will create a second rule which will perform the field comparison.

Step 3a - Create New Rule

As before, create a new Custom rule with the following parameters:

Name:

  • “Admin - CSM Change - Create CTA when CSM Assignment Changes”

Fields:


  • Account::Id

  • Account::Account Name

  • Account::CSM

  • Account::CSM Old

Step 3b - Create CTA Action

Create a new Action.  You may select some fields per your preference, but observe the following:

  1. Action Type: Call to Action
  2. Name: In this case we specify that this is an Admin rule denoting a CSM Change - you may use the @ option to add tokens
  3. Type: Event
  4. Playbook: If there are a series of tasks you want a new CSM to perform, a playbook is advised
  5. Owner Field: CSM Name is the new CSM ... appropriate for a welcome CTA
  6. Comments: Use something that clearly indicates what the action is.  Again, tokens help to provide clarification
  7. Criteria: Ensure that CSM Old is NOT equal to the current CSM.  
     

Step 3c - Test CTA Rule

As before, select at least one record to alter by changing the CSM assignment manually.

Run this rule BEFORE running the "Push Old Values" rule, as it will work by comparing differences.

To change a record:

  • Select an Account within SFDC
  • Find the field you wish to change (In this case, the CSM field)
  • Click "Save"
  • Perform a test run on the rule
     

Step 3d - Run the Rule

Again, once you are certain that the rule affects the changes you desire, you may run and confirm that it works correctly.

 

Step 4 - Schedule Your Rules

This tutorial typifies a case in which you may use rules to update data and fire CTAs.  

In such a case, correct scheduling of rules is extremely important.  For comparing data and running rules you may want to set a schedule as follows:

Step 1:

  • Perform comparison - Run "Admin - CSM Change - Create CTA when CSM Assignment Changes"

Step 2:

  • Update fields - Run "Admin - CSM Change - Push Old CSM Value"

In other words, we compare first and "sync" old/new fields second.  Thus, on the next date if there are no changes, the "compare" rule will detect no changes and no CTA will be created!