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

How to change the territory of an account in apex?

Is it possible to change the Territory of an account? If yes, please help me.

Please try the algorithm provided in the following link: there is sample SOQL which you can run and test to if if you get the assignment correct:
Territory is not a separate object as such in salesforce but its a group ID which represents a Territory: 
I have tried using those queries but I it is not changing the territory of an account.