Mixed DML Exception in salesforce

M

Hi All, Many times we face this “Mixed DML Exception” in salesforce error while updating records. This error means you are updating setup and non-setup objects simultaneously. Here you will get details about all setup objects which cannot be inserted/updated with non-setup objects.

How can you avoid this?

To Avoid this type of error you use @future methods. Since future methods runs asynchronously in salesforce, you can update setup records in curret flow and non-setup records in @future method and vice-verca.

About the author

prashant.wayal
By prashant.wayal

Category