It's all about the answers!

Ask a question

[RTC] Is it possible set different default value for enumeration item according to the workitem type


cuiwei huang (111) | asked Aug 27 '20, 6:48 a.m.

 we have a request for RTC configuration. We defined an enumerations item priority, and set the default Literal as medium. Then set priority as one attribute of all the workitems. Our request is, when new a defect, the default value of priority keep the default Literal: medium; but when user story is created, the default value of priority will be set as critical. Is that possible to realize by defining a Default Value in Attribute Customizaton?

I have some attempts:
1.In Process Configuration tab, Work Items->Attribute Customization
Create default value: Type Based DefaultPriorityValue
Provider: Script Based Default
Script:
dojo.provide("bpm.agile.DefaultPriorityValue");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
dojo.require("com.ibm.team.workitem.attribute.priority");

(function() {

var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
var priority = com.ibm.team.workitem.attribute.priority;

dojo.declare("bpm.agile.DefaultPriorityValue", null, {

getDefaultValue : function(attribute, workItem, configuration) {
var type = workItem.getValue(WorkItemAttributes.TYPE);
if (type == "com.ibm.team.apt.workItemType.story"){
return priority.literal.l4
}else{
return priority.literal.l2
};
}
});

bpm.agile.DefaultPriorityValue

})();

2. Go to configuration Data -> Work Items -> Types and Attributes
3. Select the User Story work item type and select Priority in the list of attributes
4. Edit the attribute and select Type Based DefaultPriorityValue for the default and save.

It doesn't work. Is it possible to realize our request? Any problem with my way? Hope your help. Thanks in advance.

One answer



permanent link
Ralph Schoon (63.1k33646) | answered Aug 27 '20, 8:02 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Aug 27 '20, 8:02 a.m.

A literal is a string, return "priority.literal.l2";


Comments
cuiwei huang commented Aug 27 '20, 8:26 a.m.

 Thanks, Do you mean I should change return priority.literal.l4 to return "priority.literal.l4"?

It does not work, too.

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.