Skip to main content

Questions tagged [user-mode]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
41 views

Deploy new field and Apex class WITH USER_MODE

I'm attempting to deploy a change that adds a new Custom Field and changes Apex code to include a query of this new field using "WITH USER_MODE." The deployment fails because the test class ...
Michael Paisner's user avatar
0 votes
0 answers
23 views

What Fields Can The Automated Process User Access Using User Mode?

This is somewhat related to a past question of mine: Automated Process User and AccessLevel.UserMode - Should It Lose Access?. As per that question, when Apex executes as the Automated Process user ...
Matt Lacey's user avatar
  • 25.8k
0 votes
0 answers
46 views

Using DML AccessLevel to insert a record throws exception in Post Install class

Considering I've a Managed Package which have a Post Install script that gets executed on package installation or upgrade. My post install Apex class is decorated using without sharing keyword for ...
VarunC's user avatar
  • 6,040
1 vote
2 answers
80 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
  • 587
1 vote
1 answer
115 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
134 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
469 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
1k 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.8k
9 votes
3 answers
761 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.8k
9 votes
2 answers
2k 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,040
3 votes
1 answer
192 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
231 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
  • 137k
8 votes
3 answers
2k 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