+ Start a Discussion
Park Walker (TAGL)Park Walker (TAGL) 

Territory Assignment

I'm trying to figure out how to assign territories to an account (the organization has Territory Management enabled). The Territory field is defined as a large, read-only text field, so there appears to be no easy way to assign Territory Id values to it. It also does not appear in the Enterprise WSDL (because it's read-only?). My only solution so far is to create a field on the Account and then write an assignment rule that uses that field to assign the correct territory. Not the best.

Is anyone doing any territory management via the API and have some insight into this?
I didn't completey understand whether you had an API question or a UI question, so I'll try and answer both.

To manually assign territories, you need the Manage Territories permission turned on in your profile.  When turned on, that read-only territories field on the Account page layout will have a "change" link (similar to how the Owner field does it) that allows you to assign territories to that account manually.

To assign them automatically, you need to create territory rules.  Sounds like you figured that one out already.  If you want an Account to automatically run rules when a user saves a record, go to the Page Layout and make sure the "Run territory assignment rules on save by default" value is checked on that Layout.

I have not had to do anything with this before, but according to the API docs, the AssignmentRuleHeader header option needs to be set.  I would start with that.
Park Walker (TAGL)Park Walker (TAGL)
The question was an API related one. It turns out that he answer is not in the Account object but in the AccountShare and Group objects. An entry in the AccountShare table that connects the Account to the Group that is related to the Territory with a RowCause of TerritoryManual will 'manually' assign the Account to the territory.