0

Whenever an user is inserted, I am assigning the license(UserPackageLicense) through Future method and also sending an email if we doesn't have enough license number. But I am getting the following error:

First error: SendEmail failed. First exception on row 0; first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): EmailMessage, original object: UserPackageLicense: []

Could you please help me how to do mixed dml operation in the future method EmailMessage and UserPackageLicense

0

To resolve this error,you need to separate the Setup and Non-Setup Method Transaction in future method.

PFB the link which describes how to separate the code for the same.

https://sfdcadda.blogspot.com/2017/08/future-method-and-prevent-mixed-dml.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.