when I create a child record linked to the parent and that child has lookup to Contact X, I want to share the parent with contact X
How can I do that?
Attribution to: doga
Possible Suggestion/Solution #1
Your order of action sounds wrong? Probably you mean something like "when I create a child record linked to the parent and that child has lookup to Contact X, I want to share the parent with contact X".
It doesn't look like you can achieve this with just configuration (for example criteria-based sharing rule) because these can be used only to share with Roles/Groups, not individuals. Can you use Apex managed sharing? There's a nice example of an "after insert" trigger in the docs, you'd have to create one like that on the child object.
Another option would be to simply route all viewing / edititng of the object through VF page and controller that would have "without sharing" modifier and you'd be responsible for proper data filtering.
Attribution to: eyescream
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/4034