+ Start a Discussion

Apex Sharing Calculations



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.