Notes and Tips
- 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
- 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 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:
- Click "Setup" within SFDC and navigate to Customize > Accounts > Fields
- 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"
- Step through each screen
- Security, etc
- 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::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:
- Select the "Load to SFDC Object" Action
- Select the "Account" Object Name
- For Operation - select "Update"
- Select +Field Mapping and add the following fields:
- Account ID - Check the "Include in Identifiers" checkbox
- Account:: CSM - Mapp to CSM Old
- 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
- 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.
- Click the "Run Now" button
- For a test run, check the box adjacent to "No actions will be performed ..."
- 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:
- “Admin - CSM Change - Create CTA when CSM Assignment Changes”
- Account::Account Name
- Account::CSM Old
Step 3b - Create CTA Action
Create a new Action. You may select some fields per your preference, but observe the following:
- Action Type: Call to Action
- Name: In this case we specify that this is an Admin rule denoting a CSM Change - you may use the @ option to add tokens
- Type: Event
- Playbook: If there are a series of tasks you want a new CSM to perform, a playbook is advised
- Owner Field: CSM Name is the new CSM ... appropriate for a welcome CTA
- Comments: Use something that clearly indicates what the action is. Again, tokens help to provide clarification
- 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:
- Perform comparison - Run "Admin - CSM Change - Create CTA when CSM Assignment Changes"
- 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!