Salesforce blog use with sharing

Make sure you use with sharing in Lightning Controllers

What is this critical update about?


As of 29/10/2020, Salesforce plans to enforce this Critical Update with Spring ’21.

First and foremost, Apex classes without a sharing declaration is insecure by default. Therefore if you are impacted by this Critical Update, it is high time to review all your Apex classes sharing declaration, and not only the Aura and LWC Apex controllers that are impacted here! Check here the Salesforce best practices around Sharing declaration.

This Critical Update can have a big impact on your current customizations using Lightning Components or Lightning Web Components if it doesn’t follow the Salesforce best practice of having explicitly defined the sharing declaration of each class. In particular this Critical update focuses on Apex Controller class. Once enforced, it will considered any Apex Controller class without an explicit sharing declaration as With Sharing. As this could make sense at the first sight this could also not be the behavior you expect to be!


More Information about this critical update


Check if you are impacted and how to test this critical update by consulting this Salesforce article : Release notes Use With Sharing For @AuraEnabled Apex Controller.


Have you found this interesting? Please share!


Leave a Comment

Your email address will not be published. Required fields are marked *