There are few method available in workflowhelper to get the workitem from PBO.below are the some methods you select based on your requirement.
WorkflowHelper.service.getWorkItems( Persistable ,WTPrincipal , Role );
WorkflowHelper.service.getWorkItems(Persistable );
WorkflowHelper.service.getWorkItems(Persistable ,String);
WorkflowHelper.service.getWorkItems(Persistable ,String);
WorkflowHelper.service.getWorkItems(Persistable , WTPrincipal , String );
Example
// get all all activity of the Approver role for given PBO (Promtion Request )
QueryResult workitems = WorkflowHelper.service.getWorkItems(PBO, Role.toRole("APPROVER_MANDATORY"));
while (workitems.hasMoreElements()) {
WorkItem tmpworkitems = (WorkItem) workitems.nextElement();
System.out.println("Inside WorkItems");
workItemsVector.add(tmpworkitems);
if (tmpworkitems.isComplete()) {
System.out.println("Workitem is completed ");
} else {
System.out.println("Workitem is not completed ");
}
}
hope this helps !!!
Thanks,
Shreyas