Why I am getting "Too many DML Statements" error when performing Update operation in LWC salesforce?

Why I am getting 'TOO MANY DML STATEMENTS ERROR IN THIS LINE?'

Note: Class is auraenabled(cacheable =true)

 List<ABC> obj1 = new List<ABC>(); for (ABC A1 : [SELECT ID,field1, field2, field3, (SELECT Id, Name,ParentId,CreatedDate FROM Attachments WHERE Name LIKE 'something' ORDER BY CreatedDate DESC Limit 1) FROM ABC WHERE field5ID = 'field5ID' ORDER BY field1]) { if(!A1.Attachments.isEmpty()) { for (Attachment Att : A1.Attachments) { MAP1.put(A1.field1,A1.Id); if(A1.field2 = true){ A1.field2 = false; Obj1.add(A1) ; } } } } if(Obj1.size() > 0){ update Obj1; //GETTING ERROR ON THIS LINE }
0 Related questions 0 Update is not a function mongoose 0 How to update data in multiple objects at the same time using same method in firebase? 288 ReactJS: Maximum update depth exceeded error Related questions 0 Update is not a function mongoose 0 How to update data in multiple objects at the same time using same method in firebase? 288 ReactJS: Maximum update depth exceeded error 1 Property 'update' and 'quantity' doesn't exist on type '{ }' 0 Trouble in reactjs Update operation 2 Update Many with mongoose - Array of update objects 0 Update Information Using DML in Aura 1 ReactJS - Maximum update depth exceeded error 0 LWC, set record to database soql from JavaScript with wire and Apex, error 0 Maximum update depth exceeded error in react app Load 7 more related questions Show fewer related questions Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like