December 25 2016
Salesforce Tip: Territories with a Read-Only Custom Formula
Salesforce doesn’t support territories for Leads in its Territory Management or Enterprise Territory Management features. (Our company hasn’t upgraded to Salesforce Lightning, so I’m not sure whether the new version includes this feature.)
However, you can set up sales territories as a read-only custom formula. As a formula, the field is always up-to-date, a stark contrast compared to the territories in Territory Management, which require you click “Run Rules” every so often. (We use Territory Management for Opportunities and Accounts, and every so often, we realize the territories aren’t correct. We have to click “Run Rules” to fix them.)
Let’s walk through how to set up a custom formula:
- Go to “Setup” > “App Setup” > “Customize” > “Leads” > “Fields”.
- Click on “New” under “Lead Custom Fields & Relationships”.
- For the field settings, use “Formula” for “Data Type”, an appropriate label for “Field Label”, and “Text” for “Formula Return Type”.
- For the formula, I translate “Country” into regions. Because custom formulas are limited to 5,000 characers, I couldn’t use a CASE statement. Instead, I used CONTAINS, with a colon separator because CONTAINS matches substrings. You can use any separator that doesn’t match the argument. See my version in the GitHub Gist below.
- To verify your version, use “Check Syntax”.