cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get Workitem?

SOLVED
Highlighted
Newbie

How to get Workitem?

Hi all,

I'm editing Variance Workflow via Workflow Manger.

I have the PrimaryBusinessObject variable. But how can I get the appropriate Workitem object?

Thanks a lot

Tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to get Workitem?

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

2 REPLIES 2

Re: How to get Workitem?

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

Re: How to get Workitem?

Thanks a lot!

Announcements

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum! ______________________________ Check out the Windchill Tips Board! We're talking about Whirlpool's use of digital twin, augmented reality, and data-driven design!

The NAVIGATE WORKING GROUP is here! Come innovate with PTC!

Sign up for a Working Group