Error: MIXED_DML_OPERATION Few days back while writting an test class I encounterd an Error stating System.DmlException: Insert 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): You will get this Error if you are trying to perform DML on setup and non-setup objects in same Transaction. Non-Setup objects can be any one of the Standard objects like Account or any Custom objcets, Below are few examples of Setup objects 1. FieldPermissions 2. Group You can only insert and update a group in transaction with other SObject . Other DML operations are not allowed . 3. GroupMember You can only insert and update a group member in a transaction with other sObjects in Apex Code saved using Salesforce.com API version 14.0 and earlier. 4. ObjectPermissions 5. Permissio...