Skip to main content

Questions tagged [user-mode]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
25 views

Issue with attempting update to System.AccessLevel.USER_MODE -- Cannot specify both an external ID reference Owner and a salesforce id, OwnerId: []

I'm trying some of the new features to Apex to automatically apply User Access. I cannot get an update to work that worked from with a require "update" or "Database.update()". ...
Ken's user avatar
  • 450
1 vote
1 answer
59 views

Is Salesforce Deprecating WITH SECURITY_ENFORCE?

I was recently going through the Enforce User Mode for Database Operations salesforce documentation. In that documentation salesforce recommends to use USER_MODE to enforce FLS instead of WITH ...
Ranjit Mishra's user avatar
2 votes
0 answers
50 views

Salesforce code analyzer returns issue when using "as user" with dml

When I use delete with 'as user' and run sf code analyzer i get this problem: "PMDException: Error while parsing E:\testpro\force-app\main\default\classes\TestCl.cls Caused by: net.sourceforge....
Nazar's user avatar
  • 45
2 votes
1 answer
286 views

SOQL query 'WITH USER_MODE' then update

I fetch ObjectA records with a SOQL query 'WITH USER_MODE'. Then I modify those records and want to update them in user mode I am not sure if the previous 'WITH USER_MODE' command is enough to prevent ...
Bob Bob's user avatar
  • 21
8 votes
2 answers
627 views

Reliable Detection of an Automated Process User

Because User Mode database operations don't work for the Automated Process User, I need to litter my code with checks to see if the current user is such a user. I've previously got an automated ...
Matt Lacey's user avatar
  • 25.7k
8 votes
3 answers
455 views

Automated Process User and AccessLevel.UserMode - Should It Lose Access?

Has anyone tried using the new user-level access DML operations with the automated process user, say in a platform event trigger? It seems as though calling Database.insert(records, AccessLevel....
Matt Lacey's user avatar
  • 25.7k
9 votes
2 answers
963 views

Executing SOQL with User Mode and then DML with user Mode causing Exception

I couldn't find if SOQL and DML become interlinked when using WITH USER_MODE with SOQL and DML both in single transaction. I've below sample code to be triggered on a button from an LWC: @AuraEnabled ...
VarunC's user avatar
  • 6,000
3 votes
1 answer
142 views

Enforce User Mode in Dynamic SOQL - String or Parameter?

Is it equally appropriate and safe to use each of those Dynamic SOQL calls with USER MODE or should I prepare one over the other? The official documentation doesn't make that clear. User Mode as part ...
Robert Sösemann's user avatar
4 votes
1 answer
208 views

Is the User Mode approach to object and field security acceptable in a security review?

This Enforce User Mode for Database Operations looks by far the cleanest approach to implement the object and field-level security that is required to pass a Salesforce AppExchange Security Review. (...
Keith C's user avatar
  • 136k
7 votes
3 answers
1k views

With USER_MODE - do we still need SOQL and DML libs?

As the Security model of Apex was leaky in the past, everybody who took - or as AppExchange Partners had to take - Security seriously was building or using libraries to enforce CRUD/FLS rules. The ...
Robert Sösemann's user avatar