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

Hi,
 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



werewolfwerewolf
This thread discusses some possible causes:

http://community.salesforce.com/sforce/board/message?board.id=Visualforce&message.id=434#M434
sanju21sanju21

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!!

JPClark3JPClark3

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

sanju21sanju21

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