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!

10 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.


  4. Hi Jennifer, thanks for all your tutorials it’s very helpful.
    I’m trying to create a flow based on your example to reassign leads on user deactivation for the manager but i’m having some issue with this flow error : Number of iterations exceeded.
    Have you experienced this problem ? I tried to create a subflow to limit the number of simultanous reaffectation but it doesn’t work, maybe i’m doing this the wrong way. If you have any clue it would be wonderful.
    Have a nice day !


  5. You’re going to need to provide more information on your use case. I recommend posting to the Trailblazer Community and @mention me with screenshots of your flow.


  6. thanks for your answer, do you have a link for a particular trailblazer community so i can post all screeshots for my flow ?


Comments are closed.