You need to sign in to do that
Don't have an account?
kamal3883
How to Identify New territory is assigned to Account in Apex?
Hi All,
Is there is any possible way to identify when a new territory is assigned to account. Actually when we assign territory to account a record of object ObjectTerritory2Association is created. But we cannot write trigger on ObjectTerritory2Association. So is there anything through which i can identify same in Apex. Anyother solution like creating fields or trigger on any object through which i can acheive same.
Is there is any possible way to identify when a new territory is assigned to account. Actually when we assign territory to account a record of object ObjectTerritory2Association is created. But we cannot write trigger on ObjectTerritory2Association. So is there anything through which i can identify same in Apex. Anyother solution like creating fields or trigger on any object through which i can acheive same.
Here you need to write trigger on Account, if its territory is populated, create a new record of ObjectTerritory2Association like below. Please fill the required fields of your object and update the API name as per your requirement. Let me know if you need any other help.
Thanks,
Neetu
But how can i populate Territory on Account.
Its depends on your requirement, whether its while creating/editing Account on the standard layout, or you have created any visualforce page or there is any backend coding.
If not, then what is the criteria to populate territory?
Thanks,
Neetu
Since triggers are not allowed on ObjectTerritory2Association, the only way I can think of doing it is via a batch sweep. That is run a daily batch of ObjectTerritory2Association records inserted in the last day and process them.