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.
One answer
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.