Skip to main content
16-Pearl
October 2, 2015
Solved

Workflow Comments

  • October 2, 2015
  • 3 replies
  • 11457 views

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

Best answer by BenPerry

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.

3 replies

15-Moonstone
October 2, 2015

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?

GregOlson16-PearlAuthor
16-Pearl
October 2, 2015

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

1-Visitor
October 2, 2015

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

1-Visitor
October 2, 2015

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.

23-Emerald I
October 15, 2015

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.

12-Amethyst
October 16, 2015

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

GregOlson16-PearlAuthor
16-Pearl
October 2, 2015

Thanks everyone for the responses....I think I need to go back to the Sales Department and discuss requirements a bit more.