Assign Territories to Opportunities More Efficiently (Generally Available)

Filter-Based Opportunity Territory Assignment lets you use a simple job to assign territories to opportunities. We provide code for an Apex class that you can use as-is or modify as needed based on our guidelines. After you create and deploy the class, run the job to complete the assignment process. Job options include making assignments within date ranges and assigning territories to open opportunities only. You can also configure your settings to run the job every time an opportunity is created.

Opportunity territory assignment is enabled for qualified organizations by default.

The Apex class code Salesforce provides assigns territories to opportunities based on a number of factors.
  • Is the opportunity excluded from filter-based territory assignment? If so, no territory is assigned.
  • Does the opportunity have an account assigned and does that account have a territory assigned from the active territory model? If so, the account’s territory is assigned to the opportunity. If not, no territory is assigned.
  • Does the opportunity’s assigned account have multiple territories from the active model assigned? If so, the job can use a priority value from the Territory2type object or other criteria to determine which territory (if any) to assign to the opportunity.

For complete instructions on setting up and deploying filter-based opportunity territory assignment, see Enterprise Territory Management Implementation Guide. For details about the Apex class you need to create and deploy, see New and Changed Apex Classes.

Opportunity Territory Assignment Settings