function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Stephen E 4Stephen E 4 

Getting errors when writing to ObjectTerritory2Association via the API


We are currently trying to write a program that will auto assign territories to an account. However we are getting the below error:

Association Cause: bad value for restricted picklist field: Manual

If I attempt to remove this from the api call, it tells me that Association Cause is required. How am I supposed to write to this field?(What am I supposed to write to this field?) Can I change this to an unrestricted picklist?
Best Answer chosen by Stephen E 4
Raj VakatiRaj Vakati
Hi  ,
You need to set the value to "Territory2Manual" not Manual  
Select Id,AssociationCause from ObjectTerritory2Association where AssociationCause !='Territory2AssignmentRule'

AssociationCause  ='Territory2Manual'


AssociationCause  ='Territory2AssignmentRule'

Thanks ,