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
d3developerd3developer 

DML currently not allowed

Logged in from the sysadmin account to another user in order to load some automatically generated sample/test data.  Get this error when it tries to run a for loop in the constructor inserting FeedPosts:

 

"DML currently not allowed"

 

Will report back as I explore further...

Best Answer chosen by Admin (Salesforce Developers) 
Jon Mountjoy_Jon Mountjoy_

Hi

 

You'll need to provide a lot more context I'm afraid - it's impossible to debug otherwise.

 

However, have you done a search?  Check out these links:

http://community.salesforce.com/sforce/board/message?message.uid=82925

http://developinthecloud.wordpress.com/2009/11/23/dml-currently-not-allowed/

 

Jon 

All Answers

d3developerd3developer

The insert doesn't work on the admin user either.

 

Error from the debug log:

 

15:55:17.425|DML_BEGIN|[61,13]|Op:Insert|Type:FeedPost|Rows:1
15:55:17.425|EXCEPTION_THROWN|[61,13]|System.Exception: DML currently not allowed
15:55:17.425|CODE_UNIT_FINISHED

 

Jon Mountjoy_Jon Mountjoy_

Hi

 

You'll need to provide a lot more context I'm afraid - it's impossible to debug otherwise.

 

However, have you done a search?  Check out these links:

http://community.salesforce.com/sforce/board/message?message.uid=82925

http://developinthecloud.wordpress.com/2009/11/23/dml-currently-not-allowed/

 

Jon 

This was selected as the best answer
d3developerd3developer

Yep, Wes' post covered it. DML Exception in the constructor.

 

 

Fixed.