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
Koen (BvD)Koen (BvD) 

Trouble running DML statements

Up to now I haven't been able to run dml statements that are not textbook examples. My current error message is

 

bvdep:DML currently not allowed

 

An unexpected error has occurred. Your development organization has been notified.

 

 

where bvdep is the namespace I assinged for my managed package. The testmethod that executes the same code works ok (I insert the record, and then fetch it in the test method), so I can only assume that it is somewhere related with permissions.

 

Although the message states that "your development organization has been notified" , I didn't get any message (up to a week or two ago, I would get an e-mail in the event of such a message, but this stopped  working, I no longer get these messages, I am also having difficulties displaying the system log, something that would work perfectly up to a few week ago)

 

Koen.

 

Best Answer chosen by Admin (Salesforce Developers) 
Koen (BvD)Koen (BvD)
I found the answer by searching the forum, sorry should have done that before posting (but still would like an more comprehensible error message)

All Answers

gv007gv007
Check yours personal information .Developer mode is enable or not if so explain little bit more.
Koen (BvD)Koen (BvD)

I am not in development mode, I installed the package on a different account and have the same result. the code is quite simple, I create a new custom object (that is also part of the package) initialize its properties and then call the insert (call is within try catch with a DMLException catch) the code is on the controller of a component (also part of the package) I thought it might be something that I shouldn't call DML in get methods, so I moved it to an action method and associated it with a command butoon but I still have the same result.

 

The insert statement itself is ok, because it runs when called from the testmethod I placed on the class.

Koen (BvD)Koen (BvD)

I suppose you asked if I were in development mode because I would get more information in development mode?

 

Well you are right there is a whole world of information displayed now, It added the magical words "system.exception" (wauw, now I reallyknow what is wrong) and I got a line number (but that I already knew as I had only one DML statement in the code)

 

System.Exception: bvdep : DML currently not allowed

 

Class.bvdep.ProductInstallerController.Install: line 78, column 17 External entry point

 

 

 

Koen (BvD)Koen (BvD)
I found the answer by searching the forum, sorry should have done that before posting (but still would like an more comprehensible error message)
This was selected as the best answer