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

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

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.


0 votes



One answer

Permanent link

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.

0 votes

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,016
× 7,489

Question asked: Jul 09 '18, 6:39 p.m.

Question was seen: 1,563 times

Last updated: Jul 10 '18, 3:45 a.m.

Confirmation Cancel Confirm