Opportunity assignment to territories
Key Takeaway
Users set an opportunity's territory manually in the Territory field, and filter-based opportunity territory assignment sets it automatically with Apex. To offer both, enable "Filter-Based Opportunity Territory Assignment" in the territory settings and add the Territory field to the Opportunity page layouts.
Sales Territories lets you assign an opportunity to a territory so the intended reps can work the deal and territory managers can access their reps' opportunities. Territory assignment also enforces the principle of least privilege for the reps and managers in each territory. The assigned territory controls which territory forecast the opportunity rolls up into, so assignment affects forecasting too.
Two ways to assign a territory
There are two ways to give an opportunity a territory. With manual assignment, a user picks a territory in the opportunity's "Territory" field. With filter-based opportunity territory assignment, filter logic in an Apex class chooses the territory automatically.
The two methods work together, so an org that uses filter-based assignment can still let users set the Territory field themselves. To offer both, an administrator enables "Filter-Based Opportunity Territory Assignment" in the territory settings and adds the Territory field to the Opportunity page layouts. Users can only pick a territory in a field they can see and edit, so the field needs to be on the layout.
Sunrise Foods uses filter-based opportunity territory assignment with the Salesforce-provided Apex class. The job runs when opportunities are created. The filter assigns a new opportunity to the Midwest territory, but Leo, a sales manager, knows the deal belongs to the Great Lakes territory. The Territory field is on the Opportunity page layout, so Leo opens the opportunity, selects Great Lakes in the Territory field, and saves.