Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Is there any API or workaround to get the vote from a WorkItem?
Solved! Go to Solution.
You have to do so. The information is not stored in the WorkItem
You have to get the voting events and drill the information from that.
PetrH
Hi @OP_11714882,
Thank you for your question.
I’d like to recommend to bring more details and context to your initial inquiry.
It also helps to have screenshot(s) to better understand what you are trying to do in your process.
This will increase your chances to receive meaningful help from other Community members.
Best Regards,
Vivek N
Community Moderation Team.
Hello,
My Windchill version is 12.1.2.11
I want to create a custom REST endpoint in which I want to add the vote of a WorkItem
I tried using the following way but is there any another way to get the vote from the workitem
WfAssignment wfa = (WfAssignment) workitem.getParentWA().getObject();
WfAssignedActivity wfaa = (WfAssignedActivity) wfa.getSource().getObject();
WTArrayList auditCol = (WTArrayList) WfEngineHelper.service.getVotingEvents((WfProcess) wfaa.getParentProcess(),
null, null, null);
Iterator auditEvents = auditCol.persistableIterator();
while (auditEvents.hasNext()) {
WfVotingEventAudit audit = (WfVotingEventAudit) auditEvents.next();
System.out.println(" Activity Name = " + audit.getActivityName());
System.out.println(" Vote = " + audit.getEventList());
}
Hi @OP_11714882
You could have tried to search.
input key words the vote and workitem
Unable to get user comments and votes while approving the promotion request or approve tasks.
Solution is mentioned in the link.
getVotingEvents
PetrH
wt.fc.collections.WTArrayList auditCol = (wt.fc.collections.WTArrayList) wt.workflow.engine.WfEngineHelper.service.getVotingEvents((wt.workflow.engine.WfProcess) activity.getParentProcess(), null, null, null);
But here if I use the getParentProcess() method I get all the Tasks in the WTArrayList, Im getting other values like Name, Status etc. directly from the WorkItem so I don't want to backtrack and again run a loop on the WTArrayList. I want to retrieve the selected voting option from a WorkItem
Understood. Thanks
