I have the following objects:
- X__c (Master-Detail )
- Y__c (Master-Detail )
- XY__c (Junction object between X and Y)
- Additionally, I have another object that stores Zone__c and Region__c.
- On the User object, I also have Zone__c and Region__c fields.
- On the Y__c object, I also store Zone__c and Region__c values, but X__c does not have Zone or Region fields.
My role hierarchy is designed as follows:
- Zone level ā Branch Manager (e.g., Central, Northern, Southern, Eastern)
- Region level ā 4 states grouped under each zone
The challenge is:
š I need to share
X__c records with users based on their Zone and Region, but since X__c has no direct Zone/Region field
, Iām not sure how best to set this up.
Questions:- What are the best practices to implement record sharing for this scenario?
- Should I denormalize data (e.g., copy Zone/Region from Y__c to X__c via automation) or rely on junction object relationships for sharing?
- Is Apex Sharing a better option here compared to OWD + Sharing Rules?
- How do I align this with the role hierarchy for secure but efficient access?
1 answer
Role Hierarchy determines record access based on Ownership.
So who owns these X__c records?