You need to sign in to do that
Don't have an account?
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.
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?