How To

Flow Screen: This error occurred: MIXED_DML_OPERATION

So, you built a flow that you think will work wonderfully just to get the following error when you run debug on your flow: “This error occurred: MIXED_DML_OPERATION: DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): Account, original object: User.”


But you need this process to perform a DML action on both an non-setup object (standard or custom) and the user object.

So, what to do to fix this?!

This is a screen flow that updates an account and user record (see the blue box).


View image full screen

When you use the “Debug” feature in flow to unit test this, a flow fault has occurred due to a mixed DML operation:



If you run into this issue with a process, the resolution is to move these actions to a scheduled actions that execute 0 hours from now (essentially run as immediate actions).

If you run into this issue in an autolaunched flow, the resolution is to add a Pause flow element between the two DML actions. The Pause element will closed the DML action.


Shout out to Jason Teller, Salesforce Senior Director of Product Management of the Process Automation Team, for the assist.

To close the DML action, Jason told me that you needed to either add a Screen flow element or Local Action. This would need to be inserted in between the two DML actions.

I opted to add the Show Toast local action (refer to the below image that shows the Show Toast local action inserted between the two Update flow elements) so the user would not need to click the “Next” button on a screen flow to advance the flow progress. It shows a success message and the flow continues on. After I added it, my flow works like a charm. Thank you, Jason!


View image full screen

Note: Check out This is the unofficial Web site managed by the Salesforce Process Automation Product Management team. There are lots of cool resources including installable local actions.

Best of luck to you!

6 thoughts on “Flow Screen: This error occurred: MIXED_DML_OPERATION

  1. Nice piece of work, Jennifer. I didn’t even put together until you started investigating this that simple addition of a local action will commit the transaction. If I can find the time, I’ll publish a super simple local action called Commit Transaction, just to make it a little clearer.


  2. Thanks for helping me figure out this issue, Jen, and thanks for subsequently creating the Commit Transaction that I’ve found and used, Alex!


  3. Thank you, Jen!! I was trying to do an update to User Profile, based on a change on the Contact record, using a Process and Autolaunched Flow, and I got the dreaded MIXED_DML error. Changing the immediate action in the Process to a scheduled 0 hour action seems to have fixed the problem, and the Flow is completing as expected. Super, super helpful.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s