Tutorial Overview

Subject This use case demonstrates how NULL values can affect results which Rules Engine produces and how to address them.
Scenario It may be important to ensure that each account has at least one sponsor that will show up under the Customer 360 View. Creating a single rule and looking at the "Sponsor Tracking" object only displays information about customers who have sponsors identified.
Complexity Easy
Description Create a checkbox field within SFDC to use for detecting customers without sponsors
Challenges Access to create new fields in SFDC is required
Approach
  1. Create new custom field (checkbox) in SFDC
  2. Check if sponsor has been identified
  3. Create CTA for customers without sponsors
  4. On a scheduled basis, look for changes

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.

IMPORTANT: This tutorial requires administrative access to Salesforce.com (SFDC).

Step 1 - Create Custom Field (Checkbox)

Within SFDC, create a Custom Field in Customer Info - call it “Customer Has Sponsor”.  This will provide a placeholder to tie back to the Sponsor Tracking object and detect Accounts for which there are no sponsors.

To create the Custom Field, perform the following steps:

  1. Under SFDC, select Setup > Create > Objects.
  2. Click Custom Fields & Relationships.
  3. Under Custom Fields.
    • Click New.

  • Step 1: Choose the field type
    1. Select Checkbox.
    2. Click Next

  • Step 2: Enter the details
    1. Field Label = “Customer Has Sponsor”
    2. Default Value = Unchecked
    3. Field Name = “Customer_Has _Sponsor” (Will auto-populate)
    4. Description:  
    5. Click Next.

  • Step 3: Establish field-level security
    1. Per your company’s guidelines, select the appropriate level of permissions

  • Step 4: Add to page layouts
    1. Finalize/Save
    2. The field should be saved and visible

NOTE: If the field does not become visible in Step 3 (below), log out/back into Salesforce. When finished, click Save & New to create more custom fields, or click Save if you are done.

Step 2 - Identify Customers with Sponsors

Create New Rule - Admin: Sponsor Check

  1. Create a new rule.
  • Rule Type:  Custom
  • Rule Name: Admin: Sponsor Check
  • Description: <Something denoting intent of the rule>. Refer the following image.
  1. In the Show field, select:
  • Account::Id
  • SponsorTracking::COUNT_DISTINCT of Account
  • SponsorTracking::Account Name
  1. Click NEXT.

Create New Action

  1. Click +ACTION.
  2. Select the following:
  • Action Type:  Load to Customers
  • Account::Id -> Account(string)
  1. Click +FIELD MAPPING to create a new Custom field.  From the drop-down list, select "Customer Has Sponsor (BOOLEAN)".
  2. Click +CRITERIA.
  • Add:  SponsorTracking::COUNT_DISTINCT of Account / greater or equal / value / 1

This will identify all accounts where there is one or more sponsors and check the checkbox for "Customer Has Sponsor".

Run the Rule

Run the rule and confirm that it correctly identifies accounts that have sponsors.  
1. Click RUN NOW. The following wind is displayed.
Note: You receive a notification mail that confirms your request to run the specific Custom rule is succeeded and you also receive the results as attachment to the email. The following image shows a sample summary of the rule execution. 

Step 3 - Create Rule that Generates CTAs for Accounts Without Sponsors

Once the "Admin: Sponsor Check" has executed, the checkbox fields in the Customer Info object will be updated correctly with a value of "true" for those accounts meeting the criteria. Sponsor information is now available and can be leveraged with second rule that will detect and notify a CSM for customers that have no Sponsor identified.

Create New Rule - Detect Customers With No Sponsor

  1. Click +RULE to create a new rule.
  • Rule Type:  Custom
  • Rule Name: Detect Customers With No Sponsor
  • Description: <Something denoting intent of the rule>

  1. In the Show field add:
  • Account::Id
  • Account::Account Name
  • Customer Info::Customer Has Sponsor
  • Account::CSM
  1. In Filters add:
  • Customer Info::Customer Has Sponsor / equals / "unchecked"
  1. Click NEXT.

Create New Action - CTA

To create a CTA, select the Create CTA  check box and fill out the following fields:

  1. Name:  Used to title your CTA. Type @ to see options available for tokenized comments.
    • Include in identifiers: adds the CTA's name as part of the duplicate checker criteria for the Rules Engine. If there's an existing CTA for an account, but the CTA names have different values, then the rule will create the new CTA. If the CTA names are the same, and the CTA Type and Reason are the same, then a new CTA will not be created. The rule will simply update the existing CTA. The playbook chosen in this step will only be applied if a playbook was not previously assigned.
  2. Priority:  Based on previously established Severity Types
  3. Type:  Based on previously established Types
  4. Status:  Based on previously established Status Types
  5. Playbook: Optional.  Based on previously established Playbooks
  6. Reason: Based on previously establish Reason Types
  7. Owner Field: Optional. From the account level can be based on any user lookup field.
  8. Due Date: Run Date + x Days.  Drop-downs below address treatment of weekends.
  9. Default Owner: Lookup field of all SalesForce Users. This will be used if the Task Owner field is not filled in OR if an account has not been assigned an owner.
  10. Link to an existing "Linked Object": Multiple relevant objects can be linked in a rule. All Linked Objects that are linked to the CTA type, will be available in the drop-down. When a linked object is selected from the drop-down, Admins can choose the field to which it should be linked from the Show fields.
  11. Post Update to Chatter: Used to control the frequency of Chatter updates.
  12. Post Update to Comments: Used to control the frequency of Comments updates.
  13. Comments: Optional and shows up in the comments section of the CTA. Type @ to see options available for tokenized comments.
  14. Create CTA once in: Admins can select the Create CTA once in check box in the Create CTA action to prevent the creation of CTAs based on the timeframe selected. A separate check box will be available for separate actions.
  15. Click SAVE to move to the next step or click +ACTION to add more actions.

Run the Rule

Run the rule.  CTAs should be created correctly.

NOTE:  This may produce a number of CTAs.  Know your data and perform a test run to understand impact. 

Step 4 - Additional Rule and Scheduling

Prior to scheduling, one more rule should be created which:

  • Will "uncheck" all checkboxes on the Customer Info object.
  • Is run prior to the "Admin: Sponsor Check" rule

This will ensure that if a sponsor is removed from an account, the previous scripts will detect and notify correctly.

Create New Rule - Admin: Uncheck "Has Sponsor" Checkbox for All Accounts

In the Show field, add (refer the following image):
  • Account::Id
  • Account::Account Name
  • Customer Info::Customer Has Sponsor

Create new Action

  1. Click +ACTION to create an action where,
  • Action Type:  Load to Customers
  • Account::Id -> Account(string)
  1. Click +FIELD MAPPING to create a new Custom field.  From the drop-down list, select "Customer Has Sponsor (BOOLEAN)"
  2. Leave the checkbox unchecked (denoting NULL)
  3. Click SAVE.

This will identify all accounts where there is one or more sponsors and check the checkbox for "Customer Has Sponsor". This rule should be scheduled to run BEFORE the other rules above.

Using Rule Chains

Rule Chains enable you to group related rules and apply a shared schedule. For more information, refer to the Rule Chains article. The following instructions describe how to group the rules you created above into a rule chain.

In the previous steps, three rules were created which use a checkbox field on the Customer Info object to indicate which customers have no sponsors.  This is important, as querying against the “Sponsor Tracking” object only displays results for customers which have sponsors.

Create Rule Chain

1. Click +RULE CHAIN.

2. Enter a Name and (optional) and Description for the Rule Chain.

3. Click CREATE.

Add Rules to the Rule Chain

1. Select the first rule.

2. Click + to the right to nest the rules according to the following image.

        a. Admin: Uncheck "Has Sponsor" Checkbox for All Accounts. This clears the checkbox across all accounts

        b. Admin: Sponsor Check

        c. Detect Customers With No Sponsor

3. Click SAVE, and proceed to Schedule.

Schedule the Rule Chain

In the Schedule window, set your preferred schedule and click CREATE.

Completed rule chain

Each rule chain displays as a card as shown in the following image. You can edit the rule chain and turn the status ON/OFF.