I have created a flow that looks up for opportunity object and then performs certain modification.

******The flow works fine in the sandbox however when I run the same flow in production. I get "Too many DML Statements 151".******

The issue seems to be Data dependent on the number of opportunity records being modified.

I searched for this and found that we can avoid this error in code by modifying the code to reduce the number of DML statements.

https://developer.salesforce.com/forums/?id=906F000000093BAIAY https://help.salesforce.com/apex/HTViewSolution?id=000004825&language=en_US Too many DML statements: 151 - no DML in a for loop (that I can see)

Any suggestions on how to handle this in a flow would be appreciated!


  • 1
    Can you post your code/flow?
    – kurunve
    Jan 22, 2016 at 15:54
  • 3
    as far as I guess -- you are looping on records, and doing DML every single record. Try to add records to collection and perform single DML
    – kurunve
    Jan 22, 2016 at 21:06
  • I tried to bulkify the flow and used fast update and that resolved the issue. Thank you all for the help!
    – force007
    Feb 3, 2016 at 20:17


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.