DML operations on certain sObjects, sometimes referred to as setup objects, can’t be mixed with DML on other sObjects in the same transaction. This restriction exists because some sObjects affect the user’s access to records in the org. You must insert or update these types of sObjects in a different transaction to prevent operations from happening with incorrect access-level permissions. For example, you can’t update an account and a user role in a single transaction.
If you use a Process to attempt to do both things in a single transaction an error will appear.
Error: An error occurred at element myRule_1_A1 (FlowRecordCreate).
INSERT --- INSERT FAILED --- ERRORS : (MIXED_DML_OPERATION) DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): Invoice_Statement__c, original object: User
Steps to reproduce:
1. Create a Process on the User Object
2. Set the criteria as Active | equals | True
3. Set the Immediate Action as Create Record on the Account object.
4. Activate the Process
5. Create and Activate a New User.
If you use a validation rule to attempt to update User and Contact objects such as in the following use case:
Validation Rule:
IF( Community_User_s_Account_ID__c== $Setup.COMM_Profile__c.BluIdAccountId__c , IF( OR(ProfileId== $Setup.COMM_Profile__c.FullAccessProfile__c ,ProfileId== $Setup.COMM_Profile__c.BasicProfileId__c) , true, false),false) Community_User_s_Account_ID__c is a formula field in User to get value of "Contact.AccountId"
When logging in, the user will get an error:
"... you cannot mix EntityObjects with different UddInfos within one transaction: id = 003********"
or more specifically:
"We can’t log you in because of the following error.
ERROR_CREATING_USER: Validation Formula "UserProfileSwitchRule" Invalid (java.lang.IllegalStateException: Programmer Error: you cannot mix EntityObjects with different UddInfos within one transaction: id = 003**********"
Steps to reproduce:
1. Login to Community URL - e.g., https://<instance-community-URL>/<community-name>/s
2. Click on [Sign In] button in upper right-hand corner
3. Login to community using the Username and Password credentials for an authorized user.
4. The above error is generated
When the action runs in the same transaction, add the action under the Scheduled Action. This placement separates your update or create action from your Immediate Actions.
Scheduled Action is available under the following conditions:
The Evaluation Criteria setting is:
IMPORTANT: This implementation is NOT allowed as explained in the error message containing this format -
"...(java.lang.IllegalStateException: Programmer Error: you cannot mix EntityObjects with different UddInfos within one transaction: id = 003**********"
This is a limitation in the existing functionality.
Note: Standard Auth providers such as Salesforce or Facebook aren't affected by this limitation. These providers are like the custom implementation in the described use case. You can use a workaround to avoid mixed objects from User validation rules for custom Auth providers.
For example:
1. Comment out the statement that is thrown in Auth registration handler -- e.g., // update(u);
2. Modify the validation rule to *not* mix the setup and non-setup entity objects as specified in the references below.
Tip (Optional): Disabling the validation rule makes it work.
000382600

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.