Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Translate the entire conversation x

Get vote from WorkItem

OP_11714882
6-Contributor

Get vote from WorkItem

Is there any API or workaround to get the vote from a WorkItem?

ACCEPTED SOLUTION

Accepted Solutions
HelesicPetr
22-Sapphire II
(To:OP_11714882)

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

View solution in original post

6 REPLIES 6

Hi @OP_11714882

Thank you for your question. 
I’d like to recommend to bring more details and context to your initial inquiry
 

  1. What version of Windchill are you using?
  2. What is the desired outcome or next step after retrieving the vote from the WorkItem? How will this information be used?
  3. Have you tried any existing methods or APIs in Windchill to retrieve this information? If so, what were the results?
  4. Are there any specific challenges or obstacles you have encountered while trying to get the vote from the WorkItem?

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());

}

HelesicPetr
22-Sapphire II
(To:OP_11714882)

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

HelesicPetr
22-Sapphire II
(To:OP_11714882)

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

Understood. Thanks

Announcements


Top Tags