Whats wrong with this script?
I want to make the field (Name="Release Note Description", ID="release_note_description") to be mandatory if the value in (Name="Release Note Required", ID="release_note_required") is set to "Yes". The literals are "Select a value, Yes, No). I have the following script, but it doesn't work. Please suggest:
dojo.provide("org.example.workitems.providers.ReleaseNote");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("org.example.workitems.providers.ReleaseNote", null, {
matches: function(workItem, configuration) {
var relnote = workItem.getValue(WorkItemAttributes.RELEASE);
return (relnote === "release_note_required.literal.l2"); // Yes
}
});
})();
Accepted answer
I would suggest to carefully read https://jazz.net/wiki/bin/view/Main/AttributeCustomization and also https://jazz.net/library/article/1093 and maybe do the workshop.
1. As listed in https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Accessing_built_in_attributes_of there is a list of built in attribute ID's you can use. Do you find WorkItemAttributes.RELEASE NOTE REQUIRED or WorkItemAttributes.RELEASE in the list? No, you don't. If you created a custom attribute, you have to pass the ID of the attribute to get to its value. E.g var relnote = workItem.getValue("the.id.i.gave.the.custom.attribute");would do the trick. In your case this should be correct: var relnote = workItem.getValue("release_note_required");
2. Be aware that there are limitations mentioned in the links above. You can access enumerations, strings and the like but some value types are not supported.
Comments
2 other answers
var relnote = workItem.getValue(WorkItemAttributes.RELEASE);
Comments
Don Yang
May 04 '15, 7:36 p.m.Pravin Patil
May 04 '15, 8:01 p.m.Don Yang
May 04 '15, 9:21 p.m.