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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Workflow Task, Require the Comment to befilled out?

sdrzewiczewski
7-Bedrock

Workflow Task, Require the Comment to befilled out?

Correct.

so if result=Reject then comments are required
and if result=Approve then comments are not required.

Now i just need to figure out how to get to the comments value. I'm
assuming it's somewhere in self.


Quoting "Villanueva, Antonio" <->:

> I think he was looking for a conditional required variable.
>
>
>
12 REPLIES 12

We have a similar need too.

Couple of questions:
1. If we use a process variable, do you know how we can take that and put it in the comments box that comes OOTB so that it will show in the rotuing history table?

2. How to make the OOTB comments box required? (On all tasks)
I have a piece of code editing the javascript that did it in up until Windchill 8.0 but no longer working 9.0

Has anyone done this? If so, can you please let me know.

Appreciate your input.

Regards,
Rekha.


AL_ANDERSON
5-Regular Member
(To:sdrzewiczewski)

Yes.

In the Complete transition of your workflow task, check for whatever you
want to check for, then throw an error if you don't want the task to
complete because something isn't filled out yet.

Like this.

if (myVariableThatShouldBeTrue != true) {
String msg="Please complete the missing field";
java.lang.Exception e = new java.lang.Exception(msg);
throw e;
}


Throwing the exception will cause the transition to fail to complete, and
the task will remain on the user's worklist. He will also get a nice
error message that you can tailor to whatever you want it to read.

Al Anderson









"Stephen Drzewiczewski" <steve@stevedandrebecca.com>
03/11/2009 01:28 PM
Please respond to
"Stephen Drzewiczewski" <steve@stevedandrebecca.com>


To
-
cc

Subject
[solutions] - Workflow Task, Require the Comment to be filled out?




Caterpillar: Confidential Green Retain Until: 04/10/2009



Can a Transition be used to ensure that the comment on a default task page
is not left blank?
My use case is if somebody Rejects something, I want them to provide a
justification, but if they approve it they do not need to provide a
justification.
If it can be done, how do you address the comment field on the task page?
Thanks,
Steve D.

What I'm looking check for isn't a WF Variable. It's the "Comment" textbox
on the actual task form.






Under Routing History In 9.1, the comments are user assignment specific. Each assignment, there is also a save button to save your comments:






AL_ANDERSON
5-Regular Member
(To:sdrzewiczewski)

You should be able to take the primaryBusinessObject, cast it into a
change object (i.e. (wt.change.WTChangeActivity2)primaryBusinessObject ...
or whatever the class name is), then use the getter to get the comment
value.

I don't know the exact class name or code for the getter, but it should be
something like this, or the equivalent.

String myComment = ";
myComment =
((wt.change.WTChangeActivity2)primaryBusinessObject).getComment();
if (myComment == null) {
java.lang.Exception e = new java.lang.Exception("ERROR: You must
enter comments to complete this task. Return to your worklist, enter a
comment, then click Task Complete to complete this task."); throw e;
}

My java might be rusty, but something like this should work.

Al







"Stephen Drzewiczewski" <steve@stevedandrebecca.com>
03/11/2009 05:08 PM
Please respond to
"Stephen Drzewiczewski" <steve@stevedandrebecca.com>


To
"Al X. Anderson" <->
cc
-
Subject
[solutions] - RE: Workflow Task, Require the Comment to be filled out?



I'll check that out tomorrow.



Thanks


Why duplicate information with a variable. The comments are part of the process. This comment exist routing/process status table. What is your use case? Do you need to pass the value from one workflow activity to another or is it just required for a report?



I don’t know if there is constraints in the comments within a workflow.

· It is not a preference

· Most likely modeled, you can change that (of course, that is not supported)






Patrick,



What I am looking to do is within my workflow, verify that a user has filled out the OOTB “Comments” textbox, if the Approver “Rejects” the task. If they “Approve” the task there is no need for them to provide feedback.



In a workflow, the transition tab, a user can place some java code. One of the abilities you can do is validate that some criteria has been met before moving on to the next task. If the criteria has not been met you can throw an exception and provide the user a helpful error message.



I understand where the Comment value is stored in the UI and even the database, but none of that is useful to my current requirement which is to decide if the Comments is required to not be blank.



Is that a better explanation of what I’m looking for?

Steve D.


If this is a workflow variable whether as the primary business object or not:

· Then it is only a single value

· It is not based on multiple participants/roles.

· There are various options in the workflow:

o

o If multiple users are assigned to the roles, is the comment optional requirement based on the role? Thus, a single workflow variable may not be the solution. You may need one as a flag for each role.


This is not a workflow variable from the Variables tab. Attached are three screenshots.



The first is the task form that the user receives and shows the OOTB Comments field that I want to retrieve the value from the UI to use in a the transition.

TaskComments.png

The second is the workflow activity variables tab. You can see there is no variable for Comments.

TaskVariables.png



The third is the workflow activity transition tab. For this particular task, if the user completes the Task, but still has the PBO checked out it will throw an exception and alert the user to check in the document.

TaskTransition.png

What I’m looking to do is on other Activities where the users have to Vote either “Approve” or “Reject”, if they select “Reject” I want them to fill in the Comments field. I plan to check in the Reject Transition if the Comments == Null but I need to determine how to grab the Comments value



Hopefully that is more clear for you

Steve D.




Variable are variables those are store din the process variable/obj. You are
looking for again what I have talked about on here numerous times. These
particular comments for voting (where routing is used) are stored into the
wfvotingaudit comments column in the table. Do a search on ptcuser.org
forums for my name. You'll find the code. The code needs to cast results
from the the wf helper class to a wtarraylist before iterating it.







Dave











_____
AL_ANDERSON
5-Regular Member
(To:sdrzewiczewski)

It seems the comments are on a different object.

You will need to know what object has the comments in order to figure out
if you want to throw an error. But you can definately throw an error to
(1) not complete the task, and (2) give a message to the user why the task
didn't complete. You can even use HTML tags in your error message to make
your text message larger font and/or color coded for emphasis.

Al





"Stephen Drzewiczewski" <steve@stevedandrebecca.com>
03/11/2009 05:27 PM
Please respond to
"Stephen Drzewiczewski" <steve@stevedandrebecca.com>


To
"Al X. Anderson" <->
cc
-
Subject
[solutions] - RE: Workflow Task, Require the Comment to be filled out?



Top Tags