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

ReOpen Action counter using Attribute customization in Dojo JS

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; 

}); 
})(); 

0 votes



One answer

Permanent link
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.

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
× 7,495
× 1,220

Question asked: Jun 29 '16, 6:51 a.m.

Question was seen: 2,815 times

Last updated: Jun 29 '16, 8:05 a.m.

Confirmation Cancel Confirm