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.
Accepted answer
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.
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!
Comments
sam detweiler
Jan 14 '15, 6:42 a.m.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.