In my test class i have the creation of a dummy custom setting and a dummy lead:
Group g1 = new Group(Name='group name', type='Queue'); insert g1; QueuesObject q1 = new QueueSObject(QueueID = g1.id, SobjectType = 'Lead'); insert q1; SetOwner__c mycs = SetOwner__c.getValues('standardset'); if(mycs == null) { mycs = new SetOwner__c(Name= 'CustomValues'); mycs.OwnerId__c ='00520000000z3PrAAI'; mycs.RecordtypeID__c='012L00000004QsrIAE'; insert mycs; Lead lead = createNewLead(u2.id); insert lead; ERROR:
MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): SetOwner__c, original object: QueueSobject: [] I get this error because i am trying to perform DML on setup and non-setup objects in the same transaction.
Any solution for this problem?