Print this page

Cannot Mix DML Operations

Knowledge Article Number 000006037
Description Users may receive the following error when running a trigger that creates a contact every time a user is created:

caused by: 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): Contact, original object: User: []


- There are few objects which cannot be used together when performing DML operations, Please check the developer document below more information: 

  sObjects That Cannot Be Used Together in DML Operations :

 The workaround for this issue is to use a future method to perform the DML operations

promote demote