Enterprise Territory Management – Key Notes

How to use Apex based sharing to share opportunity using Territories

  • Enterprise Territory management is used to share Account and its related opportunity and Cases.
  • Account can have multiple Territories.
  • User can have multiple Territories
  • Opportunity can have only 1 Territory. Think about it – If Opportunity allowed to have multiple Territory, how revenue would be split between multiple Territory and what would be business rules ?
  • Territory enables “My Territories” and “My Team’s Territory” filter in Account and Opportunity list View.
  • While creating Territory, we can decide access to Account, Opportunity and Case. Depending on OWD, access can be private, read only and read write.
  • Enterprise Territory Management does not support overlay forecast unlike Roles. However we can create report on Opportunity split object.
  • Overlay forecast (Revenue sharing) is not supported because Opportunity can have only one territory and therefore only 1 revenue maker.
  • Maximum Territory that can be defined is around 99k unlike maximum role 10k.
  • Custom Field (but not lookup) can be created in Territory2 object.
  • Territory related list appears on user and Account records.
  • You cannot create lookup to Territory objects.
  • Territory to Opportunity can be assigned using Apex class plugin

Enable Territory based Forecast

  1. Mark user as “Allowed Forecast”
  2. Add user as Territory Team member
  3. Add user as Forecast Manager in Territory

Apex Based Sharing of Opportunity using Territory

For Apex based sharing, we use user of public group Id to share record. If we want to share Opportunity using Territory then there is quick code for that. If we click on manual share button on Opportunity, it will show an option to choose between user, public group, territory and territory with subordinates.

There is no clear documentation, but what I found that when we share using Territory, Salesforce internally creates public group for that territory and assigns that public group to Opportunity.

So, first step is to find public group created for territory. Below code showcase how it can be done.

References :