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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Force Workflow Comment on Approve Vote

PreetiGupta
15-Moonstone

Force Workflow Comment on Approve Vote

We have so many exciting workflow email threads lately, I would like to throw this one out there as well...

This is a very valid use case and asked many times in Alcon. I hope somebody has figured this out already.

We would like to our users to put comments when they are revising (for example). When they select other vote Approve in the below screen shot, it should just let it go as is and completes the task. So the criteria is ..


1) Check for the Voting option (Revise_CR)

2) Look at the Comment Attribute and force it to be filled if empty

[cid:image001.png@01CF5316.70B54EB0]

Thanks,
Preeti
14 REPLIES 14

What about doing something like this?:
rmk
7-Bedrock
7-Bedrock
(To:PreetiGupta)

Hi Preeti,


it's Simple,


Just write the following code in the routing transition on workflow,


wt.workflow.work.WfAssignedActivity activity = (wt.workflow.work.WfAssignedActivity) self.getObject();
wt.workflow.engine.ProcessData actData = activity.getContext();
String tComments= " + actData.getTaskComments(); // this will return the comments


java.lang.Exception e = new java.lang.Exception("Comments is Empty ..............Your Exception Message to Quality Enr");


if tComments.trim().length() == 0


throw new wt.workflow.engine.FailedTransitionException ( e );


else


result="true";



hope this will work for your requirement!!!


Regards


MKR

avillanueva
22-Sapphire II
(To:PreetiGupta)

We handled this via Javascript routine but if a single approval task (not multiple user task) go with workflow transition code. The Javascript method uses a custom complete button JSP fragment and a workflow task template. When the user clicks the complete button, a Javascript routing does the checking and puts up the alert. Been using it for a long time now successfully. Blocks user from completing task but works in multiple user tasks since workflow transition only gets triggered when all users complete the task and the task tries to move on.

Hello I happen to see your input. I have encountered same issue now when multiple user voting required. Can you please provide more details? I am now trying to use javascript as well. However I am not sure how to get the routing option filed values from the javascript.

We avoid javascript as much as possible to avoid user interface problems
during upgrades to new Windchill versions. Instead, we use Task Complete
transitions in the workflow activity template to throw a user friendly
error message when and if there is something to prevent task completion.
What is nice is that these work from Windchill version to Windchill
version without changes. Also, they checks can be routing specific.

Al







[solutions] - RE: Force Workflow Comment on Approve Vote

Villanueva, Antonio UTAS

I have tried using an exception (as in the post) to force the comment to be filled in on the trasition. This works for a task, however for later tasks if this code fires it caused the workflow process to terminate. Any idea what is happening?


Thanks,


Kelly Lozier


BMPC-KAPL

atodi
6-Contributor
(To:klozier)

Hi Kelly,

I am facing a similar issue. Were you able to resolve the problem ?

I am checking for a condition in my complete transition, if it's not fulfilled an alert message should be shown to the user.

In my case this is happening for the first time but the workflow aborts after this.

Thanks,

Archit Todi

BenPerry
15-Moonstone
(To:atodi)

Archit Todi‌,

Please confirm that your java code is placed in the Complete transition of your workflow task.  Do you have a screenshot?

Below is an example from one of my workflows.  This is actually a workflow that is routed on a WTDocument PBO.  One of the next steps is a Set State robot.  So I want to make sure the WTDocument PBO is checked in before completing the workflow task.  That is what the code does.  If the WTDocument is checked out, then when the user clicks on the Complete Task button, it will throw an error and the task cannot be completed until the document is checked in.

2017-01-03_19-54-13.jpg

atodi
6-Contributor
(To:BenPerry)

Ben

Thanks for the reply, I was able to figure out the cause.
Although my code was present in the complete transition, I had checked the following under Execution Options:

Process.JPG
After i unhecked the above option I was able to achieve the desired result.

Thanks

Archit Todi

BenPerry
15-Moonstone
(To:atodi)

Archit Todi‌,

Thanks for posting this.  I had forgotten about those checkboxes and that functionality.

Since you found the solution for this problem ... does that mean it also resolves your other one over here?: Re: RE: 10.1 Workflow Exceptions now show exception log etc - I don't want this

atodi
6-Contributor
(To:BenPerry)

Yes Ben Perry
the other problem is solved as well.

Can you show your workflow and where the code is at?



[cid:image001.gif@01CF7046.C96AB930]

Stephen Vinyard
Business Development Manager/Solution Architect

1. create / modify the existing action and add onClick function


2. create a javascript function


3. varify the selection of routing and return false if you need a comment

May you advise how I can get two fields values on the task page from the javascript? Process and routing options. I need process name so I can limit this only to a certain wf and routing options to only RTI then comments should be required. Your help will be greatly appreciated.

Announcements


Top Tags