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

JavaScript condition based on value of custom attribute?

I'm doing a JavaScript-based condition to be used to determine dynamically if an attribute should be required, based on
https://jazz.net/library/article/1003/#conditions

We want a custom String field (Submitter phone) to be required whenever a custom Integer field (DevWorksID) is equal to 0.

I've looked in a couple other places:
https://jazz.net/wiki/bin/view/Main/AttributeCustomizationExamples#Determine_the_value_set_for_an_e
https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Conditions

and everything seems to only work off built-in attributes.
Is this possible?  I'm on 4001.

Thanks,
Susan

0 votes


Accepted answer

Permanent link
Yes, I have tried conditions with custom attributes and it worked for me.
Here is a dummy script:
dojo.provide("com.example.Condition");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");

(function() {
    dojo.declare("com.example.Condition", null, {
        matches: function(workItem, configuration) {

         var DWID = workItem.getValue("DevWorksID");
         console.log("HERE IS THE VALUE" + " " + DWID);
          if (DWID=="0") {
            return true;
        }
        else  {
            return false;
       }
        }
    });
})();
Then from Operations Behavior-> Save WorkItems, add the precondition "Required Attribute for Conditions"  and add your new condition for the required attribute(s).


Susan Hanson selected this answer as the correct answer

2 votes

Comments

oh geez, now i feel a little silly :-)

Thanks so much!
Susan

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
× 10,926

Question asked: Aug 06 '13, 6:43 a.m.

Question was seen: 4,388 times

Last updated: Aug 06 '13, 7:18 a.m.

Confirmation Cancel Confirm