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.

Workflow Comments

GregOlson
15-Moonstone

Workflow Comments

I need ideas on how to get comments sent to all participants in a workflow.

Example:

We have a doc called Sales Call Report, basically it's a document that is filled out after meeting with a customer.  Then it's routed around to various departments notifying them of the visit and what transpired.  People have been commenting when completing task thinking that the comments are sent to the creator.....but they are not.  I have explained that the comments are viewable only if you go back in and look for them.  Is there a way to have the creator of the document notified if a comment is entered down stream in the workflow?

Thanks in advance:

Greg

1 ACCEPTED SOLUTION

Accepted Solutions
BenPerry
13-Aquamarine
(To:DonSenchuk)

Don Senchuk‌,

Sorry for the delay.  I'll take the time to lay this out for you a little more verbose.  Others will probably also find it useful.

I have the scenario where 1st the Review Drawings task.  And 2nd, the Rework Drawing Change task (if that route is chosen).  Refer to it below.

2015-10-07_16-10-16.png

So I have the process variable commentsDesignerRework, as we've already discussed.  In your implementation, you can call the variable name whatever you wish.  But for the example, I will stick with this for consistency.

In the Review Drawings task, I need to add the commentsDesignerRework variable in the Variables tab.  And then add that 3 lines of java code to get the task comments and assign it to the commentsDesignerRework String variable.  Refer to the 2 screenshots below.

2015-10-07_16-11-28.png

2015-10-07_16-12-03.png

Then, I need to take a look at that 2nd task - the Rework Drawing Change task.  I also need to put that variable in the Variables tab of the workflow task.  And then in the instructions, call that variable out as {commentsDesignerRework}.

2015-10-07_16-12-46.png

2015-10-07_16-13-18.png

I think at a minimum, what you're missing is adding the commentsDesignerRework variable to the Variables tab of the 2nd task - the Rework Drawing Change task in this example.  When the workflow task instructions (and the email notification) render strictly as {commentsDesignerRework} instead of the actual value that is stored in that variable, then that is a tell-tale sign that the variable is missing from the Variables tab of the workflow.

View solution in original post

31 REPLIES 31
BenPerry
13-Aquamarine
(To:GregOlson)

Greg,

This can get you started, perhaps.  In my case, I create a process level variable (such as commentsDesignerRework in the example below).  And then in the Complete transition of the task, enter this code:

wt.workflow.work.WfAssignedActivity activity = (wt.workflow.work.WfAssignedActivity) self.getObject();

wt.workflow.engine.ProcessData actData = activity.getContext();

commentsDesignerRework = actData.getTaskComments();

That will pull the comments into the process level variable.  From there, you can carry it forward to whatever other tasks you want.  Or do whatever else you want to do with it.

The scenario I'm not sure about is when multiple users need to complete a task.  I guess if it is in the Complete transition, it will only grab the Comments from the last user that completed the task.

Does this help?  Or are you looking for something else?

GregOlson
15-Moonstone
(To:BenPerry)

Ben,

Not sure if that will work either...I guess I am looking for a way that if someone enters a comment the creator gets notified.  This will work, but I would need to add this code to each node.

Thanks,

Greg

kpritchard
4-Participant
(To:GregOlson)

Greg,

Can you live with the comments, if any being sent to the creator after the completion of a certain assignment node?  I use similar to Ben Perry‌ to propagate comments from one taske to another or to an email notification.  Example is that for pooled assignments all users ned to complete and then the comments are gathered.  For most uses I find this is acceptable.  If you can have comments captured and sent to the creator after all departments have completed then it's easy.  As Bob Sindelar mentions below, you would build a String process variable in a a downstream Expression Robot (I haven't tried the Complete Transition for this) and use that in a Notification Robot to the Document Creator.‌

It souds like you want the addition of comments by any participant to trigger the code/notification.  If this is the case, you may want to consider using Discussions/Subscriptions for that "real time" response.  I'm not sure how you would get the addition of comments by one participant to trigger action prior to completion by others within the same Node.  If I absolutely needed this I would look at making multiple Node streams in parallel and assign individually to each of the departments and capture comments and Notify when each "Review & Comment" Node is completed.

The feasibility comes down to your exact requirments on timing

Keir,

Could you go into more detail concerning the option you mention in the first paragraph with the expression robot?  I am new to all this workflow creation and could use a little more info...

-marc

kpritchard
4-Participant
(To:mdebower)

I think the mechanism you're looking for is a Workflow Robot that evaluates an upstream Task to get whatever text was entered in the comments and makes it available downstream by setting a process variable that can be passed into task variables.

Feel free to contact me for specific help

Ben,

Could you go into this in a little more detail?

I tested out what you posted but when doing a Check Syntax, I'm seeing:

kpritchard
4-Participant
(To:DonSenchuk)

Don - did you create an activity variable of type String with name commentsDesignerRework?  If you're executing the code in the Complete (or other) Transition of the Assigned Activity.  You probably want an equivalent process variable to pass the value to/from the activity variable

That could be it. I put one in the Workflow properties.

That corrected my syntax error. I still can't get those comments into the email notification for the next Assigned Activity. I'll have to keep working at that one.

kpritchard
4-Participant
(To:DonSenchuk)

Add your downstreamActivityVariable in the Instructions text area on the Activity Tab of the downstream activity (see below).  The downstreamActivityVariable is initialized from the processVariable... the upstreamActivityVariable copies into the processVariable

ActivityVariable.jpg

I must be getting lost somewhere in all this.

I have a process variable: commentsDesignerRework

The first activity has the variable: commentsDesignerRework

The first activity has the code Ben laid out for the Complete transition.

The second activity has the following in the Activity tab: {commentsDesignerRework}

When the email notification goes out for the second activity, the emails just contains {commentsDesignerRework} instead of the text I put into that cell when completing the first activity.

This why I asked for a more detailed explanation. I know I'm getting lost in it somewhere.

kpritchard
4-Participant
(To:DonSenchuk)

Don - the second activity does not have any "awareness" of either the upstream activity variable or the process variable.  The second activity needs a variable to have the String value (text) passed into from the process variable.

Right. And that's accomplished by...

BenPerry
13-Aquamarine
(To:DonSenchuk)

Don Senchuk‌,

Sorry for the delay.  I'll take the time to lay this out for you a little more verbose.  Others will probably also find it useful.

I have the scenario where 1st the Review Drawings task.  And 2nd, the Rework Drawing Change task (if that route is chosen).  Refer to it below.

2015-10-07_16-10-16.png

So I have the process variable commentsDesignerRework, as we've already discussed.  In your implementation, you can call the variable name whatever you wish.  But for the example, I will stick with this for consistency.

In the Review Drawings task, I need to add the commentsDesignerRework variable in the Variables tab.  And then add that 3 lines of java code to get the task comments and assign it to the commentsDesignerRework String variable.  Refer to the 2 screenshots below.

2015-10-07_16-11-28.png

2015-10-07_16-12-03.png

Then, I need to take a look at that 2nd task - the Rework Drawing Change task.  I also need to put that variable in the Variables tab of the workflow task.  And then in the instructions, call that variable out as {commentsDesignerRework}.

2015-10-07_16-12-46.png

2015-10-07_16-13-18.png

I think at a minimum, what you're missing is adding the commentsDesignerRework variable to the Variables tab of the 2nd task - the Rework Drawing Change task in this example.  When the workflow task instructions (and the email notification) render strictly as {commentsDesignerRework} instead of the actual value that is stored in that variable, then that is a tell-tale sign that the variable is missing from the Variables tab of the workflow.

That's great. Worked like a charm. It was the missing variable in the second task.

The only strangeness I saw was this new entry for comments below the normal Comments box. A quick change to uncheck the 'Visibility' box in the variables solved that problem.

lgrant
14-Alexandrite
(To:DonSenchuk)

Hi. How do you hide those OOB "comments"?

I don't see them in the workflow properties / Variables or on the individual task variables.

Follow up question:

That code you provided worked great for Change Activity. Is it the same for Change Notice? If not, do you know what would work?

BenPerry
13-Aquamarine
(To:DonSenchuk)

Yes, it should work.  I am actually using it in a Change Notice workflow - not a Change Activity workflow.  FYI...I'm also using it a workflow that is initiated on a WTDocument.

Does anyone know of a way to get the Comments collected in the Change Activity into an Assigned Activity in the Change Notice itself?

Hi @BenPerry 

 

I want to do same but the transition Rework

will it work for me?

Its working

@RS_10128209 

Try it.

PetrH

bsindelar
6-Contributor
(To:GregOlson)

Thinking about this a little differently:  you could use a workflow variable to accomplish this.  If you are familiar with the OOTB Change Management workflows, then you've seen a "Special Instructions" variable they have on workflow tasks.  That workflow variable will remain populated throughout the rest of the flow once set.  You can have it show up on future workflow tasks and also be sent in e-mail notification bots as well.

The nice thing about this method is that you can name this variable whatever you like (instead of being forced to use "Comments") and you can also decide on a per workflow task basis if the variable MUST be filled out by someone or is optional (if that is advantageous to you), or even show it as read only to the workflow task owner.  You can also have multiple workflow variables too.  This is also an OOTB configuration: no code writing necessary.

LoriSood
22-Sapphire II
(To:bsindelar)

There were a couple of articles written a while ago that provide examples of how to update/adding variables, including Comments, within the workflow.

For your reference:

https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS182596

https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS185827

They are somewhat similar to what has been suggested above, but also accommodate appending the values entered in by different users.

I just wanted to add a quick note...

About the second one, I tried to implement that many times and it never worked properly. Ben's method felt much easier to both follow and implement.

There is also a related CS for Special Instructions: https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS184118

LoriSood
22-Sapphire II
(To:DonSenchuk)

Hi Don,

Do you happen to recall what problems you had with getting the second one implemented? If possible, I'd like to make sure the article is useful so any feedback you have on the procedure would be appreciated.

Thanks!

Hi Lori,

Check Syntax wouldn't come back clean. I was in the midst of attempting to implementing that CS when I saw this thread and Ben's solution. Once I got Ben's suggested solution working I never revisited the CS to troubleshoot further.

In looking it over now, these are the issues that pop out to me:

  • What's with all that code? Compare what the CS telling the admin to put in with the three lines in Ben's solution.
  • The CS adds a second comments box. If someone doesn't know to uncheck the 'Visibility' box, as I didn't at first, it's just adding clutter for the admin to explain away to the user.

The Special Instructions one worked fine during testing, for what that's worth. But then, that seems to get half way to Ben's solution. It adds a process variable and an activity variable. Leaving it visible leaves an input field and looking at the OOTB workflow it's only going between the reviewer and assignee (for the rework loop).

Lori,

The second link isn't viewable.  It says that it is "Error: Document 185827 is not customer viewable as it is an internal PTC document."

Thanks

I just talked to tech support and there were issues.  It needs to be a customization now.

Top Tags