It's all about the answers!

Ask a question

ReOpen Action counter using Attribute customization in Dojo JS

Salman Shaikh (23412372) | 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.


(function() { 
var WorkItemAttributes=; 

dojo.declare("", 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 (62.7k33643) | answered Jun 29 '16, 8:03 a.m.
edited Jun 29 '16, 8:05 a.m.
From :

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.