cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

We are happy to announce the new Windchill Customization board! Learn more.

Summarize Workflow Comments

sdrzewiczewski
7-Bedrock

Summarize Workflow Comments

I would like to be able to add each approver and reviewers
vote/comment to a workflow variable so it can be passed back to a
rework step or added to the body of an email.

What would be the best way to do this?

Thanks,
Steve D.
10 REPLIES 10

Well, hopefully this will help get you started. This simply gets a list of all the signatures for an object and prints their name, vote and comments to stdout.

public static void printAllSignatures(WTObject primaryBusinessObject) {
LifeCycleManaged lcm = null;

if (primaryBusinessObject instanceof LifeCycleManaged) {
lcm = (LifeCycleManaged) primaryBusinessObject;
Vector vector = LifeCycleHelper.service.getAllSignatures(lcm);
if (vector.size() != 0) {
for (Enumeration enumeration = vector.elements(); enumeration.hasMoreElements();) {
LifeCycleSignature signature = (LifeCycleSignature) enumeration.nextElement();

System.out.println("Signed by: " + signature.getSignerName());
System.out.println("Vote: " + signature.isVote());
System.out.println("Comments: " + signature.getComments());
}
}
}
}

Thanks, that's got me in the right direction, but I'm still not able
to see my comments...

I think the issue that I'm having is this, my activity is a "Default"
activity type. I have a manual/exclusive routing, I have the options
Approve | Rework as routings a user can select. The comment on this
"route" is what I'm looking to retrieve.

When I used your code and changed the Activity to a "Review" activity,
it picked up the comments, but that's not the type of activity that I
will be using.

Any ideas?

Below is the code I have in my expression robot

-------

String myComments = ";

wt.lifecycle.LifeCycleManaged lcm = null;

if (primaryBusinessObject instanceof wt.lifecycle.LifeCycleManaged) {
lcm = (wt.lifecycle.LifeCycleManaged) primaryBusinessObject;
java.util.Vector vector =
wt.lifecycle.LifeCycleHelper.service.getAllSignatures(lcm);
if (vector.size() != 0) {
for (java.util.Enumeration enumeration = vector.elements();
enumeration.hasMoreElements();) {
wt.lifecycle.LifeCycleSignature signature =
(wt.lifecycle.LifeCycleSignature) enumeration.nextElement();

myComments+="Signed by: " + signature.getSignerName()+"\n";
myComments+="Vote: " + signature.isVote()+"\n";
myComments+="Comments: " + signature.getComments()+"\n";
}
}
}

wfComments=myComments;

------




Quoting Thomas Busch <tom.busch@stryker.com>:

> Well, hopefully this will help get you started. This simply gets a
> list of all the signatures for an object and prints their name, vote
> and comments to stdout.
> public static void printAllSignatures(WTObject primaryBusinessObject) {
> LifeCycleManaged lcm = null;
>
> if (primaryBusinessObject instanceof LifeCycleManaged) {
> lcm = (LifeCycleManaged) primaryBusinessObject;
> Vector vector = LifeCycleHelper.service.getAllSignatures(lcm);
> if (vector.size() != 0) {
> for (Enumeration enumeration = vector.elements();
> enumeration.hasMoreElements();) {
> LifeCycleSignature signature = (LifeCycleSignature)
> enumeration.nextElement();
>
> System.out.println("Signed by: " + signature.getSignerName());
> System.out.println("Vote: " + signature.isVote());
> System.out.println("Comments: " + signature.getComments());
> }
> }
> }
> }
>
>

How are you gathering comments from your users in the default task? Are you simply using a String variable on the task, which then provides a text box on the task page? If so, you should just be able to extract the text from that variable in your routing method.

-Tom

No. On the task form there is a "Comments" field that is there by default.



Quoting Thomas Busch <tom.busch@stryker.com>:

> How are you gathering comments from your users in the default task?
> Are you simply using a String variable on the task, which then
> provides a text box on the task page? If so, you should just be
> able to extract the text from that variable in your routing method.
>
> -Tom
>
>

Did you make sure the record voting option was checked on the assigned
activity?

Tom's code is a different API call, but it works identical to the code I
posted several times. It all hits up the wfvotingeventaudit table/object.


David

On the "Execution Options" of the activity "Record voting" is selected.



Quoting David DeMay <->:

> Did you make sure the record voting option was checked on the assigned
> activity?
>
> Tom's code is a different API call, but it works identical to the code I
> posted several times. It all hits up the wfvotingeventaudit table/object.
>
>
> David
>
>

Attached are two screenshots of a simple workflow that contains an
assigned activity, an expression robot and then another assigned
activity. The other screenshot is of the first assigned activity's
task page.

So in this simple little example what I'm trying to accomplish is to
grab all of the users "routings" and "comments" I'm trying to do this
in the expression robot after Activity 1 is completed. In the
expression robot, i'm updating the workflow variable wfComments and
displaying that on Activity 2.

This is just a sample, assuming I can get this, I have different
applications of this. But I wanted to keep it simple for testing
purposes.

what I have right now in my expression robot was using the code that
Dax posted.
------
String myComments = ";

wt.fc.collections.WTCollection voting
=wt.workflow.engine.WfEngineHelper.service.getVotingEvents((wt.workflow.engine.WfProcess)self.getObject(), null, null,
null);
wt.fc.Persistable anItem = null;
wt.workflow.engine.WfVotingEventAudit aVote = null;

if (voting != null && !voting.isEmpty())
{
java.util.Iterator voteIterator = voting.iterator();
while (voteIterator.hasNext())
{
wt.fc.ObjectReference anItemRef =
(wt.fc.ObjectReference)voteIterator.next();
anItem = anItemRef.getObject();
if(anItem instanceof wt.workflow.engine.WfVotingEventAudit)
{
myComments += aVote.toString() + "\n";
}
}
}

wfComments=myComments;
-----

Thanks,
Steve D.

Quoting David DeMay <->:

> Did you make sure the record voting option was checked on the assigned
> activity?
>
> Tom's code is a different API call, but it works identical to the code I
> posted several times. It all hits up the wfvotingeventaudit table/object.
>
>
> David
>
>

Many thanks to those who replied and helped me to get this working. Attached is a sample workflow that takes the routing and comments from the Activity 1 and displays it in variable in Activity 2. The results aren't formatted pretty. I just put the different methods in the variable to see what output I could get.

Exactly what I was looking for :).

Thanks a lot!!

Hi Stephen,

I'm trying to modify the weigth and heigth of the comments variable by modifying the task template. As customization guide says, I have updated the following:

<tags:workiteminfo custom_variables="all_activity_variables,comments{width:50;height:5}"/">

<tags:taskpanel propertymodel="${propertyModel}" attrs="comments"/">

but it's not working.

How have you defined your comments textArea in the task form?

regards

Felipe

Top Tags