Posts

Showing posts with the label SECURITY_ENFORCED

Salesforce Fact #733 | WITH USER_MODE > WITH SECURITY_ENFORCED

What are the advantages of using WITH USER_MODE instead of WITH SECURITY_ENFORCED in SOQL? 1) WITH USER_MODE considers polymorphic fields. 2) WITH USER_MODE processes all clauses of SOQL SELECT statement including the WHERE clause. 3) WITH USER_MODE finds all FLS errors in the SOQL query, where WITH  SECURITY_ENFORCED  returns only the first error. Also,  USER_MODE  provides a method getInaccessibleFields() to check the full set of access errors. Reference:  https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_enforce_usermode.htm