It's all about the answers!

Ask a question

Script conditions and parameters


Susan Hanson (1.6k2201194) | asked Oct 22 '13, 6:43 a.m.
I have a work item that has 5 field-groups which consist of a yes/no attribute and a text field.  If "yes" is selected, I need to have the text field required.

I can do this via a script-based condition, which i have wrote and tested for one of them.  My question is: can I use the same script for all 5 of these? I can define my condition with the script and then in the process configuration source, can update to add a <parameters> tag to indicate which yes/no field to check.  However, I basically have to hard-code it for the script in general, instead of being able to specify which yes/no attribute to check when I set the script-based condition in the Operational Behaviors section.

Can this be done (did I explain it okay)? 
If not, would the best way to do this be:
1) creating 5 copies of the java-script, hardcoding the attribute IDs to check
2) create 1 copy of the javascript, but 5 different Conditions using the same Local File Path but a different Attachment Path (can I even do this?)

Thanks
Susan

One answer



permanent link
Ralph Schoon (63.1k33646) | answered Oct 22 '13, 7:58 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi Susan,

I gave it a quick look. The issue is, as far as I can tell, that the condition runs in a precondition and you don't seem to have an indicator which attribute it is running for. Apparently the idea is, the condition checks whatever needs checking and returns yes or no. all attributes that have this condition configured get that value.

Since you, as far as I can see, don't know which work item attribute the condition runs for, I think you would have to create 5 copies. In 4.0.3 and higher, the UI will detect if you try to use the same attachment path, so I think you will have to maintain 5 copies. I am not sure if this would be any easier with a Java extension.

Comments
Susan Hanson commented Oct 22 '13, 8:06 a.m.

Thanks for the confirmation .. .i didn't see anything so I thought I would ask.  I'll go ahead and get 5 copies ready and go that way.  The scripts are really short and easy, so I don't anticipate having to make many changes to them.

Your answer


Register or 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.