You need to sign in to do that
Don't have an account?
valMoto
DML currently not allowed when update a Case
Not quite sure what I am missing, but I am getting an error :DML currently not allowed when I try to update the Case.
Anyone have any ideas? I get the DML error when i call update dupCases
here's a snippet of my code.
List<Case> dupCases = new List<Case>(); for(Case c : cases){ if(c.Id != Master.Id){ c.ParentId = Master.Id; dupCases.add(c); } } update dupCases;
I had "cases" defined at the class level.
I figured out the solution. Seems that you cannot execute DML statements when it is called from the constructor of a controller (which i was doing since I wanted an automatic update when the page ran). Instead I created an action that executes a method on page load.
Here is the post where i got the idea:
http://boards.developerforce.com/t5/Visualforce-Development/System-Exception-DML-currently-not-allowed-External-entry-point/m-p/82925/message-uid/82925
All Answers
Can you tell where you have cases.....The code is not clear
I had "cases" defined at the class level.
I figured out the solution. Seems that you cannot execute DML statements when it is called from the constructor of a controller (which i was doing since I wanted an automatic update when the page ran). Instead I created an action that executes a method on page load.
Here is the post where i got the idea:
http://boards.developerforce.com/t5/Visualforce-Development/System-Exception-DML-currently-not-allowed-External-entry-point/m-p/82925/message-uid/82925