It's all about the answers!

Ask a question

ReOpen Action counter using Attribute customization in Dojo JS


Salman Shaikh (23211164) | asked Jun 29 '16, 6:51 a.m.
How to apply a counter on Re- Open action using attribute customization in Dojo. I want to show that how many times a work item is reopened.

I am using Script based calculated values code to count and show in variable. Please correct me if i am wrong at some stage.

dojo.provide("com.ibm.team.workitem.pi"); 
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes"); 

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

dojo.declare("com.ibm.team.workitem.pi", null, { 

getValue: function(attributeId, workItem, configuration) { 
matches: function(workItem, configuration) { 
var cnt = workItem.getValue(WorkItemAttributes.reopencounter);
        var act= configuration.getWorkflowAction(); 
         console.log(" action is = " +act); 

if (act === "PIworkflow.action.a22" ) { 


return cnt+1; 

console.log(" action is reject by design----false"); 
return cnt; 

}); 
})(); 

One answer



permanent link
Ralph Schoon (59.0k23642) | answered Jun 29 '16, 8:03 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Jun 29 '16, 8:05 a.m.
From https://jazz.net/wiki/bin/view/Main/AttributeCustomization :

since 4.0 M1 getWorkflowAction() returns a string that is the id of a workflow action currently selected by the user. This action will be executed when the item is saved. If the user has not selected any action this method will return null . Note: This method works only when used inside a Condition script, the return value will always be null when this is used in other customization script types.

So you can not use this in your script, well, you can, but you always get null. I am not aware of a simple mechanism to detect a state change in JavaScript.

Your answer


Register or to post your answer.