Skip to main content
1-Visitor
November 7, 2013
Question

workflow activity - pull comments into Special Instructions

  • November 7, 2013
  • 3 replies
  • 4364 views
We use the comments section to communicate within the workflows activities. Users have to hunt over to the Process tab to see these instructions.
I would like to take the Comment in the activity and put it into the workflow variable special_instructions so that it shows on the task details.
Has anyone the code?

Thanks!
Vaughn

3 replies

1-Visitor
November 8, 2013

wt.fc.collections.WTArrayList auditCol = (wt.fc.collections.WTArrayList) wt.workflow.engine.WfEngineHelper.service.getVotingEvents((wt.workflow.engine.WfProcess)self.getObject(), null, null, null);
while( auditEvents.hasNext())
{
wt.workflow.engine.WfVotingEventAudit audit = (wt.workflow.engine.WfVotingEventAudit)auditEvents.next();
System.out.println("***Transition Expression: User vote = " + audit.getEventList());
System.out.println("***Transition Expression: User comment = " + audit.getUserComment());
comments += audit.getUserComment();
System.out.println("***Transition Expression: Complete Time = " + audit.getPersistInfo().getCreateStamp());
}
System.out.println("comments = " + comments);



1-Visitor
November 18, 2013

I verified that the code from Yogesh works, as long as you put the code into an Expression Robot just following the task activity from which you want to retrieve the user-entered comments.


Thanks for the code snippet, Yogesh.



Benjamin Wilcox - IntelliServ<sup>™</sup>


PPM & PDM Administrator


IntelliServ provides broadband networking and along-string
evaluation services for high-definition downhole and sub-surface operations
> Get the Facts.




In Reply to Yogesh Bagul:



wt.fc.collections.WTArrayList auditCol = (wt.fc.collections.WTArrayList) wt.workflow.engine.WfEngineHelper.service.getVotingEvents((wt.workflow.engine.WfProcess)self.getObject(), null, null, null);
while( auditEvents.hasNext())
{
wt.workflow.engine.WfVotingEventAudit audit = (wt.workflow.engine.WfVotingEventAudit)auditEvents.next();
System.out.println("***Transition Expression: User vote = " + audit.getEventList());
System.out.println("***Transition Expression: User comment = " + audit.getUserComment());
comments += audit.getUserComment();
System.out.println("***Transition Expression: Complete Time = " + audit.getPersistInfo().getCreateStamp());
}
System.out.println("comments = " + comments);



1-Visitor
October 27, 2015

Dear all,

If you have got this code to work. Could you supply the complete code? I am getting an error about unknown auditEvents variable.

Thanks in advance.

Regards

Gautham

BenPerry
15-Moonstone
October 27, 2015

Gautham Prashanth Kandan‌, what is the error you recieve?

1-Visitor
October 27, 2015

Dear Ben,

Thanks for your reply.

Without any change to the code from above, I get the following error

     /ptc/Windchill_101/Windchill/tmp/WfExpression88659.java:39: cannot find symbol

     symbol  : variable auditEvents

     location: class wt.workflow.expr.WfExpression88659

       while(auditEvents.hasNext()) 

        ^

     /ptc/Windchill_101/Windchill/tmp/WfExpression88659.java:41: cannot find symbol

     symbol  : variable auditEvents

     location: class wt.workflow.expr.WfExpression88659

        wt.workflow.engine.WfVotingEventAudit audit = (wt.workflow.engine.WfVotingEventAudit)auditEvents.next();

Then I tried to declare auditEvents with the following code

Iterator auditEvents = auditCol.persistableIterator();

This throws an error about unknown Iterator class.

Regards,

Gautham