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
trmptrmp 

Apex Sharing Calculations

Problem:

 

I have two objects, A and B. They are currently related by a lookup field (B has lookup to A) because I have already maxed out the master-detail depth on the children of object B. I need some of the child B records to inherit the sharing rules from the parent A record. (When a sharing rule gets added or removed from A, it adds/removes the same sharing on some of the B records.)

 

Attempt at a solution:

 

Well, I cannot create Apex triggers on any Sharing objects, so I am trying to use Apex Sharing Recalculations. The problem here is that I cannot tell from the documentation when sharing rules are calculated or recalculated automatically (when the Apex class would be executed) and all my tests have prooven fruitless.

 

As a last resort, I can probably provide a custom "Update Sharing" button, but I would really prefer not to have to do that.

 

Thanks.