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
sean*harrisonsean*harrison 

System.TypeException DML not allowed on X

Using a Change Set to update sobjects and their Record Types?

Be sure check all your Profiles carefully. 

 

This lesson was learned after I migrated updates to the Case object along with custom code and a test class. I found that the tests that worked fine in sandbox were failing in production. I was getting errors like, "System.TypeException DML operation not allowed on Case" and a "not writable" error on a field that should have been writable. After checking the FLS and my Profile several times I noticed something I hadn't before: the Admin's Record Type Settings for Case was...blank! The act of updating the sobject must have cleared out the RT. Adding Record Types brought back joy.


NOTE: the code in question here WAS setting the record type on the Case object it was creating but that didn't matter.

Harika ZillaHarika Zilla

I have just run into the same issue when attempting to update the Scontrol object, I was getting error like, "System.TypeException DML operation not allowed on Scontrol".

 

Apex Code:

 

Sobject displayScontrol=schema.getGlobalDescribe().get('Scontrol').newSObject('01NV00000008TQv');
        displayScontrol.put('Description','Dummy');
        update displayScontrol;

 

Is there any other way to update Scontrol object from apex controller?