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

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

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
    }
  });
})();

0 votes



One answer

Permanent link
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

1 vote

Comments

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 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
× 12,020

Question asked: May 11 '15, 3:47 p.m.

Question was seen: 2,610 times

Last updated: May 14 '15, 7:34 p.m.

Confirmation Cancel Confirm