Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! 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
Hi @HelesicPetr, where would you put this within the Workflow?
I've attempted to put this in the Transitions of the Approval activity (Complete, Approve). I've also attempted to put this in the Routing expressions.
However, the voting events never include the most recent vote. It does include all other voting events, however.
My use case is that I'm trying to get all the Approves that voted Approve in the latest cycle, to populate a drawing in CreoView.
Hi @_1647
The point is if you put the code to the transaction that is before the storing information to the database, then it can not be retrieved from the database.
PetrH
Coming in late to this. I have two method of getting comments, both cases get copied to Discussion Forums. For Change Notices, since I have a parallel approval on a single task, I wanted comments to appear as people voted so a transition would not work. Those I believe would execute when the entire task was complete (all people voted). On my promotion notices, I opted for a simpler setup and it is in a transition which means that all comments appear in discussion forum once all folks vote. To get comments as people vote, it required a custom task template and a custom complete button to add a hook for copying comments on the complete button. Very extensive and always looking for simpler method to accomplish this.
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.