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
MnZ321MnZ321 

Get records for a custom object according to logged in Users'territory

orders__c is a MD child with accounts.
How do I get orders__c(parent) and order_lines__c(child) records according to the logged in user's territory?
For now I'm retrieving parent and child from a parent ID. In what order do I need to query territory, accounthshare, my custom object?



 
ShashankShashank (Salesforce Developers) 
This territory management data model should give you a good idea: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_erd_territory.htm
ShashankShashank (Salesforce Developers) 
This territory management data model should give you a good idea: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_erd_territory.htm