Skip to main content
Build the future with Agentforce at TDX in San Francisco or on Salesforce+ on March 5–6. Register now.

Optimize Performance for Sales Territories

Learning Objectives

After completing this unit, you’ll be able to:

  • Identify several ways to improve performance while using Sales Territories.
  • Explain how to reassign child territories efficiently.
  • Explain how to define effective filter criteria for assignment rules.
  • Determine whether to trigger assignment rules upon account update.

Introduction

Time flies! It’s been a few months since Maria Jimenez, Salesforce admin extraordinaire, set up Sales Territories for Ursa Major Solar. Her sales team’s been knocking it out of the park now that it’s so easy to keep track of who’s working on what.

Maria Jimenez, Salesforce admin, busy at her workstation late at night.

Recently, Ursa Major acquired a competitor, Capricorn Solar. To handle Capricorn’s sales territories, accounts, and reps, Maria’s putting in some extra hours. She’s especially concerned about system performance. Specifically, she’s wondering about making so many changes to her active territory model, and maintaining so many territories. Time to take it up a notch and get some advanced skills to make sure that the feature is working as efficiently as possible.

In this unit, we do our best to answer Maria’s questions about performance optimization. Let’s get started!

Avoid Excessive Rule Evaluation

First on Maria’s list is to add Capricorn’s parent territories to the territory hierarchy in Ursa Major’s active territory model. Second is to assign accounts to them. She wonders how she can minimize performance issues related to account assignment rules.

We recommend applying inherited rules to child territories.

When you add a parent territory to your territory hierarchy, it’s best to apply inherited account assignment rules to its child territories. Defining each territory hierarchy branch as its own “tree” makes the “siblings” at the same level mutually exclusive. That way, you prevent the rules engine from evaluating more branches of your hierarchy than what’s necessary, which improves performance.

Assignment rule with Apply to child territories selected.

To apply inherited rules, select Apply to child territories on the assignment rule’s detail page.

Avoid Unneeded Recalculation of Access Levels

To account for Capricorn’s territory structure, Maria has quite a few more changes to make to her active territory model. What’s the best way for her to reassign territories to other parent territories without impacting performance?

We recommend starting at the lowest level of the territory hierarchy first, making changes there, and then moving up the hierarchy level by level. Using this method avoids having to recalculate access levels to accounts, opportunities, contacts, and cases for the same territories.

Territory hierarchy with its lowest territory level highlighted.

Note: For a territory model that’s in the planning stage, this approach isn’t necessary.

Define Effective Filter Criteria in Assignment Rules

Now Maria’s ready to define the filters in some new assignment rules for the Capricorn accounts. What are some best practices for her to keep in mind to reduce performance problems?

We recommend defining criteria on numeric fields, not string fields. And avoid defining numeric criteria as text.

Operators on string fields aren’t case-sensitive, which can affect performance. So instead of defining criteria on string fields, consider defining criteria on numeric fields.

Also, numeric fields defined as text slow down performance. So, for example, in a filter criterion for number of employees, enter 1000, not one thousand.

Assignment rule with a numeric filter criterion for number of employees greater than 1,000.

Keep Assignment Rules Restrictive

As Maria continues to define assignment rules for the Capricorn accounts, we have a few more recommendations.

When you define assignment rules, make them as restrictive as possible. For example, avoid including lots of OR conditions. That way, Salesforce doesn’t assign too many accounts to a territory.

Assignment rule with filter criteria for revenue between 1 and 2 million.

Create filter criteria that reflect these ratios to get better performance.

  • More than 10,000 records associated with a territory can create performance inefficiencies. For example, 12,000 accounts assigned to a territory are probably too many.
  • For the ratio of number of territories to number of users assigned, the rule of thumb is 3 to 1.
  • And if you’re required to add more than 1,500 users to a territory, don’t use Setup. Manage user-to-territory assignment through the API.

Avoid Running Assignment Rules When Not Needed

Maria’s familiar with the “Evaluate this account against territory rules on save” option. She wonders whether she can save time using it for Capricorn’s accounts.

We recommend using caution.

You can set up Salesforce to run account assignment rules when an account is updated.

  • To set it up on the account edit page, select Evaluate this account against territory rules on save.
  • To set it up using the API, set the appropriate header parameter in the SOAP API or REST API update call.

But because Salesforce runs the assignment rules for all your accounts even when just one was updated, performance can take a hit. To avoid performance slowdowns, use these methods with caution.

Account edit page with “Evaluate this account against territory rules on save” deselected.

Tip: To keep territory-account assignment stable throughout a fiscal period, replicate your assignment rules attributes in custom fields that you add to the account page layout. Then use the custom fields in your rule definition while you continue using the original fields as before. Setting it up this way controls account attributes, so that assignment remains stable.

Maria’s learned a lot about optimizing performance and Sales Territories. Time for her to take a break! In the meantime, test your own knowledge now.

Resources

Share your Trailhead feedback over on Salesforce Help.

We'd love to hear about your experience with Trailhead - you can now access the new feedback form anytime from the Salesforce Help site.

Learn More Continue to Share Feedback