function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sai tarunsai tarun 

process builder on user object causing MIXED DML EXCEPTION

Hi All,
I had build Process Builder on User object for,
Whenever Opportunity Owner is Deactivated, that owner's manager will be the new owner of that opportunity.
for this, i had build PB on user object, and if User is deactivated, iam trying to update the Opportunity owner.
But it is throwing MIXED DML EXCEPTION.
Please Help me ,
Thankyou
Khan AnasKhan Anas (Salesforce Developers) 
Hi Sai,

Greetings to you!

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.

You can easily run into this error if you are trying to perform DML on setup and non-setup objects in the same transaction.

Non-Setup objects are standard objects like Account or any custom object.

Setup objects are Group1, GroupMember, QueueSObject, User2, UserRole, UserTerritory, Territory, etc..

For example, you cannot insert an account and then insert a user or a group member in a single transaction.

Please refer to the below links which might help you further with the above issue.

https://help.salesforce.com/articleView?id=000315345&type=1 (https://help.salesforce.com/articleView?id=000315345&type=1)

https://automationchampion.com/2017/04/20/getting-started-with-process-builder-part-64-how-to-fix-mixed_dml_operation-error/#more-10141

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas