[SalesForce] Sharing Rule & Child Objects

The Object Relationship is as below:
DEAL (Parent, Private) -> WPV (Child) -> Check List (G Child)

The checklist Grand Child Object has a Field called Governance Lead which looks up to the standard User Object.

I would like to share the Check List record with the User chosen in Governance Lead Field automatically when the record is saved. Can I achieve this?

Best Answer

Easiest answer - can you dump the "Governance Lead" and use standard OwnerId field ;) You didn't specify if the relationship is done with lookups or master-details (in m-d child objects won't have Owner field). Owner is best as it gives this user full access to the record.

Alternatively... criteria-based sharing won't work so I think you'd have to write a trigger that'd make entries in Check_List__Share table. Read about "Apex managed sharing". Just type this phrase into the Apex developer guide and read top 3 topics:

  1. Understanding Sharing
  2. Sharing a record using Apex (except in your case sounds like a trigger is better choice than a batch job)
  3. Recalculationg Apex managed Sharing
Related Topic