Showing posts with label DML. Show all posts
Showing posts with label DML. Show all posts

Thursday, July 28, 2016

Salesforce : DML currently not allowed

If you write create/update/delete operation in apex controller constructor then this error would be thrown.
You have to do some trick to get rid of this problem.
First create an action with your create/update/delete operations in your controller.
And then add the action name in your apex:page as attribute which will call with constructor.





<apex:page standardController="Account" extensions="APEX_CONTROLLER_CLASS_NAME" action="{!YOUR_ACTION_NAME}">
DO YOUR OTHER WORKS HERE...
</apex:page>