Skip to main content
1-Visitor
Nov 7, 2013 3:41 PM UTC
Question

workflow activity - pull comments into Special Instructions

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

13 replies

1-Visitor
Nov 8, 2013 2:19 PM UTC

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



Translate
1-Visitor
Nov 18, 2013 5:45 PM UTC

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



Translate
1-Visitor
Oct 27, 2015 9:49 AM UTC

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

Translate
BenPerry
15-Moonstone
Oct 27, 2015 9:53 AM UTC

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

Translate
1-Visitor
Oct 27, 2015 10:45 AM UTC

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

Translate