Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Hi Sumit,
I have a custom utility on Promotion Notice and I want to retrieve all task data like name, number, role, assignee, activity name, vote, and comments as well. So, I retrieved all the data but I am STRUGGLING to get user comments and votes while approving the promotion request or while performing the "approve" task.
If you have sent a snap of code then it would be highly appreciated.
Solved! Go to Solution.
Hi @_1647
You may run the code in wrong place 😄 getParent just return WF process, in your case there is assignedActivity so you need to solve it.
Check what the method getParentProcess returns. It should be WfProcess
I suggest you to use IDE and test class function to test a code, not just run it in the workflow...
For example run http url to run your method and see if it works or not.
PetrH
I have pbo as promotion notice and i got the other detail as below but comments and Assignee Name is not getting as who is approver or reviewer not getting :
Vote Getting as Null
System.out.println("workitem activityName is :
((wt.workflow.work.WfAssignedActivity) workitem.getSource().getObject()).getName());
System.out.println("workitem role is :" + workitem.getRole().getFullDisplay());
System.out.println("workitem vote is :" + workitem.getEventSet().toString());
System.out.println("WorkItem owner is :" + workitem.getOwnership().getOwner().getFullName());
System.out.println("WorkItem getCompletedBy is :" + workitem.getCompletedBy());
Hi @_1647
You need to get WfVotingEventAudit object
// (wt.workflow.work.WfAssignedActivity)activity
wt.fc.collections.WTArrayList auditCol = (wt.fc.collections.WTArrayList) wt.workflow.engine.WfEngineHelper.service.getVotingEvents((wt.workflow.engine.WfProcess) activity.getParentProcess(), null, null, null);
PetrH
Yes I want that but I am not getting an API. I will try your shared one
getting error on BGMS : Caused by: java.lang.ClassCastException: class wt.workflow.engine.WfProcess cannot be cast to class wt.workflow.work.WfAssignedActivity (wt.workflow.engine.WfProcess and wt.workflow.work.WfAssignedActivity are in unnamed module of loader 'app')
Hi @_1647
You may run the code in wrong place 😄 getParent just return WF process, in your case there is assignedActivity so you need to solve it.
Check what the method getParentProcess returns. It should be WfProcess
I suggest you to use IDE and test class function to test a code, not just run it in the workflow...
For example run http url to run your method and see if it works or not.
PetrH
Hello @@_1647,
It looks like you have some responses from a community member. If any of these replies helped you solve your question please mark the appropriate reply as the Accepted Solution.
Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.
Thanks,
Community Moderation Team.