How to validate a customized attribute value using another attribute value?
How to validate an customized attribute value using other attribute values?
For example, I'd like to prevent user from saving attribute "rekkyo1" value when other attributes "rekkyo2" and "rekkyo3" have invalid values.
|
Accepted answer
Make a script based validator such as this example code:
dojo.provide("com.example.Validator"); dojo.require("com.ibm.team.workitem.api.common.Severity"); dojo.require("com.ibm.team.workitem.api.common.Status"); (function() { var Severity= com.ibm.team.workitem.api.common.Severity; var Status= com.ibm.team.workitem.api.common.Status; dojo.declare("com.example.Validator", null, { validate: function(attribute, workItem, configuration) { var rekkyo1 = workItem.getValue("rekkyo1"); var rekkyo2 = workItem.getValue("rekkyo2"); var rekkyo3 = workItem.getValue("rekkyo3"); console.log("HERE IS rekkyo1 VALUE" + " " + rekkyo1); console.log("HERE IS rekkyo2 VALUE" + " " + rekkyo2); console.log("HERE IS rekkyo3 VALUE" + " " + rekkyo3); if (rekkyo2 == 'severity.literal.l1' || rekkyo3 == 'severity.literal.l1'){ return new Status(Severity["ERROR"], "Validation failed. Please input valid values in rekkyo2 and rekkyo3"); } return Status.OK_STATUS; } }); })(); Yasuyuki Tominaga selected this answer as the correct answer
Comments
Yasuyuki Tominaga
commented Nov 17 '15, 3:15 a.m.
[Example of refering other custom attributes]
|
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.