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

Account Record Type - Add Territories to Parent Account using APEX

Hi All,


I have the current situation in which we are using Territory Management:

Account has different record types. For instance Record Type A en Record Type B.


Both Record Types contain completely different type of data. But Record Type B always has a Parent of Record Type A. 

Both Record Types can contain different Territories. 


Now what we want is to run a job once a day, to find Account Records of type B, which have a change in their territories. Based on this list we would like to add the territories from record using REcord Type B to his Parent record using Record Type A. 


Now I know that Account and Territories, must be queried over AccountShare --> Group --> Territory. 


How can we best approach this? How can we foresee the SOQL Limit issues?