function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Constance Rouge 14Constance Rouge 14 

Manual sharing on Account and implicitchild OpportunityShare

Hi everyone,

I created a trigger that shares manually some accounts with a user with a"Read" permission on OpportunitySharingLevel.
Therefore, when a manual AccountShare is created, some OpportunityShare with the RowCause "ImplicitChild" are created (which is what I want so all good here).
However, if I later delete the AccountShare with another trigger, the ImplicitChild OpportunityShares are not deleted (as they should). I can't delete them manually in the code with a query on OpportunityShare + Database.delete as they are blocked (because they are ImplicitChild, not Manual).

Did anyone ever encountered this issue? And have any idea on how I could avoid it?