Payments2Us ManualsPayments2Us - Frequently Asked QuestionsEmail Template - FAQWhy I am getting the error "Mixed DML Exception - DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa)

Why I am getting the error "Mixed DML Exception - DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa)

Why I am getting the error "Mixed DML Exception - DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): EmailTemplate, original object: {1" when trying to deselect the "Available For Use" checkbox in Email template?

If you are trying to deactivate an email template so that users are not able to select it and encounters the above error.

To solve this error -

Edit the template and put <!--   at the beginning and --> at the end of the line as shown in the below screenshot.

This turns the line into a comment, vs. a more code like function.

SAVE.

Then de-select the "Available For Use" field.

This procedure is if you are trying to de-activate this email template.  If you are looking to use this, then do not comment out as your annual statements or receipts will be miss the PDF attachment.