It's all about the answers!

Ask a question

Setting up multiple conditions in a java script for use with Required Attributes for Condition


Karen Steele (1.2k4139148) | asked Jul 09 '18, 6:39 p.m.

need to setup a java script that looks at three attributes - and based on that condition make fields mandatory using the Required Attributes for Condition

I have the following, but it does not appear to be working

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

(function() {
    dojo.declare("com.example.migrationprodemerg", null, {

        matches: function(workItem, configuration) {
          
        var workitem = com.ibm.team.workitem.api.common.WorkItemAttributes;
        var environment = workItem.getValue(workitem.migration.prodnonprod);
    var state = workItem.getvalue(workitem.state);
    var migrationtype = workItem.getValue(workitem.migration.type);

        if (environment == "migration.prodnonprod.literal.l2" && migrationtype == "migration.type.literal.l4" && state != "com.ibm.team.workitem.workflow.nonprod.state.s1") {

           return true;
        }
        else
        {
           return false;
        }
        }
    });
})();

Basically the script is looking for the value of preprod + emergency and a workflow state that is NOT "initial"

Any help gratefully appreciated.


One answer



permanent link
Ralph Schoon (63.4k33646) | answered Jul 10 '18, 2:24 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Jul 10 '18, 3:45 a.m.

Unfortunately the question is so terribly written, that I can not even begin to answer. Please read How should I ask a question in the Forum if I want to receive useful answers?

What does "does not work" mean? E.g. what do you see and what have you done.

You can play with code and for example always return true or false to see if it works in principle.
In addition it makes sense to either debug if possible (Use Crome Developer tools) or to log/output data. E.g. to check your assumptions about the values you test against.

In addition the documentation might be useful: https://jazz.net/wiki/bin/view/Main/AttributeCustomization see the section about ID's of state values.

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.