function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
.Net WebService.Net WebService 

DML currently not allowed

 I created a custom object in sales force  and tried to insert records from a custom apex class. I am getting the following message

DML currently not allowed


Thanks In advance

This thread discusses some possible causes:

I am getting the same error when I am trying to insert a lead in Apex constructor...and the pagelink werewolf pointed is not worked, please help!!


System.LimitException: DML currently not allowed - is the error I am getting and there is no proper documentation in apex guide related to LimitException!!


In my experience, you cannot insert objects (Standard or Custom) in the constructor of an Apex class.


Yes, thats correct, thats what I realized after I posted the question...thank you :)