Overview
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.
- Know your data to ensure that Usage Data is clean and accurate.
Advice for the New Admin
This tutorial includes several important lessons that help new Admins towards a broader understanding of Rules Engine and, in particular, how to avoid common pitfalls.
- Use the Correct Time Identifier for Usage Data
Pay close attention to the time identifier when working with Usage Data.
- In this case use "Date" - this is associated with the actual date for data
- Do not use "Created Date" - this is the date when SFDC created the record and may not be the same as the "Date" for Usage Data
- Define Date Ranges with Calculated Fields
While calculated fields are a powerful asset to Rules Engine, a deeper understanding of the functionality is also required. For instance, this tutorial defines:
- Average of Page Views over the last 4 weeks
- Maximum of Page Views over the last 3 months
Important: You must define a point in time for the Rules Engine to start from while calculating. Otherwise, it may start from a different point in time than expected, so the rule may seem not to work.
- Filters should be used to dynamically identify the date range. Commonly you will define what a week looks like (see below)
- Once you have bounded a time period (in this case a week, in others it could be more) then it can accurately go back and perform the calculation.
- For Calculated Fields - Set Usage Data Aggregation Level to "ACCOUNTLEVEL"
For Calculated Fields to function correctly, Usage Data Aggregation Level Must be set to "ACCOUNTLEVEL". Other options might cause odd results or not work correctly.
Know Your Data!
Inspect your data and ensure that it is in a good state without gaps (for example, NULLs). If your Usage Data is incomplete, refer to Tutorial - Setting Usage Data Metrics to Zero for Period X, to replace NULL or missing values with zero values.
Configure a Scorecard Measure
In this tutorial, the RYG Grading Scheme is used.
To create:
- Navigate to Administration > Scorecards 2.0.
- In the MEASURES tab, click +MEASURE and create the required 'Pageviews' measure.
- Select the SCORECARD tab.
- Click +SCORECARD.
- Create 'Pageviews Scorecard'.
- Configure other parameters.
- Click SAVE.
For more information about configuring Scorecards 2.0, refer to Configure Scorecards 2.0.
Set Scores Based on Pageviews (using Rules Engine)
Create New Rule - Set Scores Based on Pageviews

Create a new rule:
- Rule Type: Bionic
- Rule For: Account
- Rule Name: Set Scores Based on Pageviews
- Description: <Something denoting intent of the rule>

- In the Show Field add:
- Account::Id
- Account::Name
- Usage Data::Page Views
- Add Calculated Field:
- Click "Add Calculated Field" to create a new field "PCT Page Views 4 WKS"
- For A: Select AVG of Page Views over the Past 4 Weeks
- For B: Select MAX of Page Views over the Past 3 Months
- This will appear in the "Show" field once complete
- In Filters:
- Usage Data::Date / greater or equal / First Day of Previous Week
- Usage Data::Date / less or equal / Last Day of Previous Week
- In Advanced Logic:
- Make sure the Time Identifier = Date
- Click NEXT.
Create New Action - Set Scores Based on Pageviews
Create new actions:
Provide the following details for each of the actions:
- Scorecards 2.0
- Select/Enter:
- Action Type: Set Score 2.0
- Select Measure: Pageviews
- Select Scorecard: Pageviews Scorecard
- Select Score from: Required field.
- Add criteria and additional actions for various ranges of pageviews as defined in the preceding Actions set for Action Type - Set Score.
- Click Save.
Run the Rule
Run the rule in test mode first to understand the results. If the results are as expected, execute the rule.

Results
For this tutorial, data is staged for three companies: Yahoo (Green), LinkedIn (Yellow), and Google (Red).
Actions run in a "cascade-like" way. The most important Actions (highest precedence) should run last.
- Yahoo is found in Green as expected
- LinkedIn falls into the Yellow category
- Google falls into Red
- Others that have no page views (but are found in Usage Data) fall out into a secondary Red category

End Notes
This tutorial explores the creation of scorecards based on existing Usage Data.
It is important to note that this rule only updates scorecards for Accounts with Usage Data. To produce scorecards for those accounts without Usage Data, you need to leverage the use of SFDC Checkbox fields and introduce additional rules to detect such states.
Examples of using SFDC Checkbox Fields can be found here: