Too many DML statements: 1 out of 0 Error in Salesforce

In <apex:page> tag, if attribute "readonly" is true and if we try to execute DML statements(Insert, Update, Delete), then it shows Too many DML statements: 1 out of 0 Error in Salesforce.

So, in order to rectify this error, set readOnly = "false" or remove this attribute in <apex:page> tag.

Sample code:

<apex:page controller="Sample" sidebar="false" readOnly="false">

Cheers!!!

1 comment: