My scenario is if some custom object X is related to the Opportunity using lookup,

On sharing the opportunity this custom object should be shared with the user or group with which opportunity is shared.

Custom object owd is private. Opporutnity owd is also private.

  • I dont think we can write trigger on share records Jul 26, 2013 at 6:43

2 Answers 2


If you make the object have a master-detail relationship to opportunity, it will automatically inherit the sharing of the opportunity object. If this isn't feasible, you'd have to write a script that periodically scans opportunity shares and replicates them to the custom object-- but this sharing wouldn't be real time, as we can't have triggers on share objects.


You should be able to allow the object to be shared to the group by creating an Apex sharing reason for your custom object under the Create -> Objects setting. I've linked to the Df wiki that seems similar to your issue.

Developerforce wiki citation

You must log in to answer this question.