It's all about the answers!

Ask a question

Attribute customization on custom work items

vikrant kamble (132354) | asked Jan 15 '16, 6:27 a.m.
 Hi All,
below is script which validate defect work item. When work item is in Resolved state its resolution should be "Fixed"



(function() {
var Severity=;
var Status=;
var 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;

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

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.

One answer

permanent link
Ralph Schoon (55.8k23642) | answered Jan 15 '16, 6:41 a.m.
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.

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

Your answer

Register or to post your answer.