It's all about the answers!

Ask a question

Problem with condition based script


Claudia Callegari (44439771) | asked Aug 18 '11, 12:12 p.m.
I have a Condition based script. Basically, for a specific WI type, I want to validate a field, and depending on the value selected on that field, I need to make another field mandatory.

My script is basically working right now, but I found another implication of this, and would like to know how to solve.

My problem is that in the way that you configure a condition script, it is not tied to a specific work item, so it runs for every work item type. The first thing that comes to my mind is a performance issue: I'm not facing the performance issue now because I do not have too much conditions implemented, but wondering if this will be a problem in the near future.

What I noticed with this implementation -and here is the deal- is that, as it works for all the work item types, and the attribute that I'm looking for is not present on all the work items, it exists with "return false". This makes all the red asterisks of mandatory fields to dissapear from my UI.
I still get the errors for the remaining fields, but one by one, and no red asterisk.

Is there anything that I should do different on this script or any kind of workaround to my problem? Thanks in advance!
Claudia


dojo.provide("org.example.workitems.providers.WPIOtherChecklists");

dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");

(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;

dojo.declare("org.example.workitems.providers.WPIOtherChecklists", null, {

matches: function(workItem, configuration) {

var checklists = workItem.getValue("com.ibm.gbs.workitem.wpi.checklists");

if ((checklists == null) || (checklists.indexOf("wpi.checklists.literal.l25") === -1) ) {
// WPI >> Checklists DOES NOT contain the value 'Other' selected
return false;
} else {
// WPI >> Checklists contains the value 'Other' selected
return true;
}
}
});
})();

2 answers



permanent link
Claudia Callegari (44439771) | answered Aug 18 '11, 2:24 p.m.
One additional information... the problem regarding missing red asterisks for mandatory fields, is happening only on the web client. (eclipse works fine)

permanent link
Claudia Callegari (44439771) | answered Aug 29 '11, 1:08 p.m.
For those following this threat, I have raised a bug to Rational. Link below.

https://jazz.net/jazz/web/projects/Rational%20Team%20Concert#action=com.ibm.team.workitem.viewWorkItem&id=174570

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.