I have a requirement whereby once a custom object record is created I must share this with AllInternalUsers. I have written a trigger on after insert to the custom object that this share record will get created and it works perfectly.

The second part of my requirement is that if a new manual sharing record gets created e.g share to Group A then the original manual share record to AllInternalUsers should be deleted. I have tried to write a trigger on after update of the custom object however the action did not take place once I created the second manual sharing record and it would also appear that I cannot create a trigger on the CustomObject__share object.

Is something like this possible to perform an action on the related record when a new manual share record gets created?

Thanks in Advance

2 Answers 2


Unfortunately, this is not possible, as share records do not cause triggers to fire. You will need to come up with an alternative solution, such as using criteria-based sharing rules or some other mechanism.


Yes you are right, one cannot have Trigger on Share Object.

You are limited to a few options here:

1) Using Scheduler: Run A scheduler everyy hour or 30 mins, which in turn trigger a batch to see if a share to Group A is created, if yes then delte the irrelevant share record.

2) Use a Custom Lightning Component for Share : Here you will create a Lightning Component and Embeded it in quick action. And remove the standard share button from layout. Your users will use quick action to open the lightning component which will use apex to handle your deleting logic while creating Apex share record.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .