It's all about the answers!

Ask a question

What to change in the below script to add "State" condition


Pravin Patil (104138133) | asked May 11 '15, 3:47 p.m.

Hi,

In workitems, the below script makes a field mandatory if priority=medium. What changes needs to be done to add a condition that, the field should become mandatory only if "state=Assigned" and "priority=medium":

dojo.provide("org.example.workitems.providers.Priority");
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.Priority", null, {
    matches: function(workItem, configuration) {
      var sev =  workItem.getValue(WorkItemAttributes.PRIORITY);
      return (sev === "priority.literal.l3"); // Medium
    }
  });
})();

One answer



permanent link
Donald Nong (14.5k414) | answered May 11 '15, 9:26 p.m.
Get the value "WorkItemAttributes.STATE", compare it with "Assigned", and do an "AND" together with the comparison on "Priority".
http://www.ibm.com/developerworks/rational/library/rational-team-concert-calculated-fields-work-item/
http://www.w3schools.com/js/js_comparisons.asp

Comments
Pravin Patil commented May 14 '15, 7:34 p.m.

By any chance, do you have the code that can be shared? I am not able to grab the scripting concepts...

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.