Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How To Create Simple Script to Validate Attribute Value and Force Entry Before Save

I am in the process of using the Milestone Work Item as a baseline template and reconfiguring it for a specific project.  In one of the requirements, if a certain attribute is set to "No", then another string field is not required and an entry can be "Saved".  If the attribute is set to "Yes" then the string field needs an entry before a "save" can be executed.  I am using a custom attribute (attrYesNo).

First question: should I be using a longer structured ID name?  Most other attributes use "com.ibm.team.workitem.attribute....", I just used the above.

Second, where can I find more examples of a script that evaluates the literal value of "attrYesNo" so that if it is "Yes" then the person is required to enter a string in another field on the screen before a "save" can be performed.  And if "No", then a "save" can be performed without the string entered.

0 votes

Comments

Just so you understand, the process with these pre-conditions is to allow the save or prevent the save with an error message. They do not provide for any additional prompting or UI functionality.


Accepted answer

Permanent link
Using "dynamic required attributes" (in later version, it is Required Attributes For Condition)precondition, you should be able to achieve what you expect. The concept and sample condition script is in the Help:

https://jazz.net/help-dev/clm/index.jsp?re=1&topic=/com.ibm.team.workitem.doc/topics/t_configuring_dynamic_required_attributes.html&scope=null

Some more scripts can be found in https://jazz.net/library/article/537(checking with Required Attributes For Condition section) or searching in the forum can also find a lot of scripting discussions.

Hopefully this helps.
Rob Olsen selected this answer as the correct answer

0 votes

Comments

Also see https://jazz.net/library/article/1093 Lab 4 and 5 for a comprehensive list of examples for conditions.

PS: I usually suggest to come up with a reasonable ID structure for customizations e.g. com.mycompany.... because this makes searching for customizations in the process XML way easier.

Awesome, thanks!

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 6,121

Question asked: Jan 13 '15, 4:45 p.m.

Question was seen: 2,938 times

Last updated: Jan 14 '15, 10:17 p.m.

Confirmation Cancel Confirm