User Mode Database Operations in Salesforce Apex to Enforce Security

#1MinuteTip Came across this tweet on user Mode Database Operations in Salesforce Apex presented in TrailblazerDX 2022 (#TDX22).

Now there is a new way to enforce user level security in your Apex code with syntax like:

INSERT AS USER new Account(Name = 'GenWatt Throwback') ;
Account a = [SELECT Id, Name FROM Account
              WHERE Support__c = 'Premier' WITH USER_MODE] ;
a.Rating = 'Hot' ;
UPDATE AS SYSTEM a 

You can view/download the full presentation from this URL.

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top

Don't Miss Out on New Step-by-Step How To Guides on Salesforce...

…Subscribe to Our Newsletter!