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.

Using presence of comments to determine workflow execution.

RichardG
1-Newbie

Using presence of comments to determine workflow execution.

Hello,

I'm currently working on an upgrade from Windchill 8.0 to 9.1. Part of this task requires that I go in and update all of the existing workflows for our business to the new system. The issue I'm having is in regards to the new comments field in Windchill workflow tasks.

Specifically I am having trouble trying to adapt one of our end-user's requirements to the new system. There is a case where, on a workflow task with three routing options (in this case approve, reject, and place on hold) they want to make it so the workflow will not advance if the comments field is left blank when the user selects either of two of the three options and leave comments optional on the third. (As you may guess the requirement is to have the comments required on a rejection or place on hold and to let approvals sail on through without them.)

In version 8.0 I'd do this by taking the comments variable and in the appropriate transition of the workflow task add a conditional to check if the variable was either null or empty and if so to throw an error message using the WTException class to prevent the task from completing. However when I use this method in 9.1 I don't get reliable behavior. In some cases the task will not advance at all even if comments are input, in others the error message will behave properly the first time you click the "Task Complete" button but the second time you click the task will advance without any comments despite the fact that one of the paths where comments are required are selected.

Has anyone had any experience doing this in version 9.1 of windchill? I've tried several different combinations of code to grab the comments from the new field, copy them into a variable, and perform the appropriate checks but nothing seems to reliably achieve what the end user desires in terms of behavior. Any assistance would be most appreciated!

--Richard

4 REPLIES 4

I'm not a fan of doing this using transitions. I prefer javascript on the client side browser. Edit the JSP for the task form template to incorporate some javascript for validation. Reply back if you still need help.

Hi Richard,

I am facing the same situation.I would like to make the comments mandatory in the workflow and I achieved this using the class mentioned in :

http://communities.ptc.com/thread/35290

But the issue is, the workflow is not going advance and the state is not getting changed.Workflow is stuck.

Request you to share if you got the answer.

Thanks,

Anuradha

LoriSood
22-Sapphire II
(To:ptc-5376636)

Anuradha,

Does it throw the exception, as expected, if comments are null? Where are you running the code? From the Routing tab? Transitions tab?

Is it not possible for you to use the Dave's recommendation of using Javascript validation?

Hi Anuradha,

There was an issue with the link you had posted (could have been on my end), but it was going to another discussion within PTC Community. I have updated the link.

Best,

Toby

Top Tags