1

I've ran into an issue trying to create a ObjectTerritory2Association object in a test class. When referencing this object, my class will not compile. There isn't a problem with the code as I can log into another org with Territory Management enabled and the code compiles and runs just fine.

In the org where the code compiles, my user has a System Admin profile. In the other, my user has a "System Admin clone" custom profile. I'm not sure if there is a difference, but my first guess is that this cloned profile is missing a permission required to access this object.

When attempting to query from the Developer Console, or compile my class, the error message I'm met with is Entity is not org accessible.

I'm not intimately familiar with Territory Management so I'm not sure if there's a setting/permission I'm missing. Any help/nudge in the right direction is greatly appreciated.Thanks

Edit: Looking at one of the answers to this question, an error is being thrown at the Territory2Type reference.

6
  • 2
    ObjectTerritory2Association object available only if "Enterprise Territory Management" has been enabled for your Salesforce org. Can you check this setting.
    – Devendra
    Aug 22, 2016 at 18:18
  • @Devendra Where would I find this setting? Aug 22, 2016 at 18:28
  • Follow below navigation, 1. From Setup, enter Territories in the Quick Find box, then select Settings. 2. Click Enable Enterprise Territory Management.
    – Devendra
    Aug 22, 2016 at 18:30
  • @Devendra When I follow those steps I'm met with two options, Manage Territories > Territory Settings || Territory Hierarchy.. Also, the fact that there are 'Multiple Territories/Hierarchy', leads me to believe Enterprise Territory Management is enabled Aug 22, 2016 at 18:32
  • Can you include code in the question?
    – Devendra
    Aug 22, 2016 at 19:10

1 Answer 1

2

As per the doc, ObjectTerritory2Association Available only if Enterprise Territory Management has been enabled for your Salesforce org.

Follow below path to enable Enterprise Territory Management-

  1. From Setup, enter Territories in the Quick Find box, then select Settings.
  2. Click Enable Enterprise Territory Management.
1
  • To turn on Enterprise Territory Management, you must request with salesforce. It changes your forecast capabilities and they want you to put in writing that you agree. Oct 22, 2018 at 20:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .