function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
scriptagentscriptagent 

Test ProcessInstanceWorkitem select statement

Hi,
I'm trying to write a testMethod for the select statement below.
 
Code:
ProcessInstanceWorkitem[] prInstWItem = [select Id from ProcessInstanceWorkitem where Id=:id_tmp]

 But when I try this:
 
Code:
ProcessInstanceWorkitem pIw = new ProcessInstanceWorkitem();
insert pIw;
ProcessInstanceWorkitem[] pIwQuery = [select Id from ProcessInstanceWorkitem where Id=: pIw.Id];
pIwId = pIwQuery[0].Id;

 I can compile the code, but then I get an error at the testRun, called:
MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object

 

What can I do to fix this problem ? Thank you very much in advance for any suggestion!

Peter

 
scriptagentscriptagent

Just I read, that you can't create,update or delete a ProcessInstance Object (Apex Language Reference).

Have anybody an idea, how I although can test my code ?