I came across a new feature on Salesforce apex sharing where you can define a batch class and can associate that batch class to an Object. Whenever security settings changes for the object the batch class you’ve associated with the object, runs to recalculate the sharing. Documented here: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_bulk_sharing_recalc.htm

Does anyone know how could I find where to associate a custom object to a batch class?


It think it is provided in the documentation link that you have mentioned, in the end.

An Apex class used for recalculation must be associated with a custom object.

To associate an Apex managed sharing recalculation class with a custom object:

From the management settings for the custom object, go to Apex Sharing Recalculations.

Choose the Apex class that recalculates the Apex sharing for this object. The class you choose must implement the Database.Batchable interface. You cannot associate the same Apex class multiple times with the same custom object.

Click Save.

  • Thanks, but I do not see such option in lightning. – Json Bourne Shell Apr 29 '20 at 21:28
  • I found the option in classic UI. Lightning does not show it, yet – Json Bourne Shell Apr 29 '20 at 21:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.