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
saripalli abhinay 17saripalli abhinay 17 

I have created a ExceptionLog object. When ever the new exception caught, i like to create a new record in my ExceptionLog Object. But it is showing a exception like Limit exception:DML Not allowed here. Can you please suggest how to resolve it?

I have created a ExceptionLog object. When ever the new exception caught, i like to create a new record in my ExceptionLog Object.  But it is showing a exception like Limit exception:DML  Not allowed here. Can you please suggest how to resolve it? Is it possible to create a new record from the catch block? Please suggest me way to achieve this issue.
Amit Chaudhary 8Amit Chaudhary 8
Please create a Different UTIL class and wite all DML code in that class and call same class from catch block.
Sachin Sharma 3886Sachin Sharma 3886
Hi Saripalli,

Instead of writting a DML operation in Catch block, set a flag variable true in catch and check if the variable is true then execute the DML after completing the catch block.

Thanks
Sachin