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

Attribute customization on custom work items

 Hi All,
below is script which validate defect work item. When work item is in Resolved state its resolution should be "Fixed"

dojo.provide("org.example.RestrictResolutionState");

dojo.require("com.ibm.team.workitem.api.common.Severity");
dojo.require("com.ibm.team.workitem.api.common.Status");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");

(function() {
var Severity= com.ibm.team.workitem.api.common.Severity;
var Status= com.ibm.team.workitem.api.common.Status;
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;

var RestrictResolutionState= dojo.declare("org.example.RestrictResolutionState", null, 

{
   validate: function(attributeId, workItem, configuration) 

{
if (workItem.getValue(WorkItemAttributes.TYPE) === "defect" && workItem.getValue(WorkItemAttributes.STATE) === "3") 
{
  
if (workItem.getValue(WorkItemAttributes.RESOLUTION) === "1") 
{
return Status.OK_STATUS;
else 
{

var severity= configuration.getChild("parameters").getStringDefault("severity", Severity.ERROR.name);

var message= configuration.getChild("parameters").getStringDefault("message", "");

return new Status(Severity[severity], message);
               
}
} else {
return Status.OK_STATUS;
}
}
});
})();

In this script id 3 is for resolved state and id 1 is for "Fixed" resolution.

I have custom work item of type "feature". "feature" is its Id. Its editor presentation is same as that of defect.
as we are using numbers in built in work item types, it does not seem to be working on custom work item.
I have state as resolved in custom work item and resolution as "feature implemented".
Both number as well as string value of state is not working in the script.
Is there any other way to access state and resolution of custom work item.

0 votes



One answer

Permanent link
1. Print the values into the log to figure what you are getting. Especially state id's have two different forms due to historical reasons e.g. s1 vs 1.
2. Attribute customization works for all work item types that have the attribute this is configured for, so you will have to determine the type as well.
3. I am not sure if attribute validation will help you with what you want to do.


See
  lab 5 for an attribute spy script you can use to print what you get into the description.

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
× 10,936
× 6,121

Question asked: Jan 15 '16, 6:27 a.m.

Question was seen: 3,598 times

Last updated: Jan 15 '16, 6:41 a.m.

Confirmation Cancel Confirm