You need to sign in to do that
Don't have an account?
Michael Dente
DML Operation on setup object is not permitted after updating a non-setup object?
When attempting to delete a product from an order I get this :DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): CustomFieldDefinition, original object: OrderItem
In the past I was able to do this so im not sure what is causing the issue. Any advice would be much appreciated.
In the past I was able to do this so im not sure what is causing the issue. Any advice would be much appreciated.
There are few objects which cannot be used together when performing DML operations, use a Future method to perform the DML operations.
https://help.salesforce.com/s/articleView?id=000325253&type=1
Please mark as Best Answer if above information was helpful.
Thanks,
There you cannot perform DML on what salesforce calls setup objects(User,Profile,Group,RecordType in this case) and non-setup object in the same context. There is a workaround that can be found here although I still had some issues.
https://help.salesforce.com/articleView?id=000315345&type=1&mode=1 (https://help.salesforce.com/articleView?id=000315345&type=1&mode=1)
Check the workarounds as mentioned in the above official article.
For further reference, you can check the below,
https://developer.salesforce.com/forums/?id=906F00000008wAZIAY
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh