I need to insert some ProcessInstances to run a few tests, how do I do that?
I did it that way:
ProcessInstance pi1 = new ProcessInstance(Status = 'Approved', TargetObjectId = recordId1);
ProcessInstance pi2 = new ProcessInstance(Status = 'Pending', TargetObjectId = recordId2);
insert p1;
insert p2;
But the console log responds:
System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [ProcessDefinitionId, CurrentNodeId]: [ProcessDefinitionId, CurrentNodeId]
Which values should I define for ProcessDefinitionId and CurrentNodeId ?