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.