It's all about the answers!

Ask a question

Work Item customization: is it possible to use Work Item Status attribute as a depedency for triggering a Calculated Value Script?


Andre Gusmao (802540) | asked May 09 '17, 10:04 a.m.

Hello,
I'm creating a script to store the previous work item state in a custom attribute. The goal is to use this attribute to prevent users from changing the state of an interrupted work item to something other than its previous state. My code so far is quite simple:

dojo.provide("com.company.alm.workitem.previousState");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");

(function() {

   var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
   dojo.declare("com.company.alm.workitem.previousState", null, {
      getValue: function(attributeId, workItem, configuration) {
         var prevState = workItem.getLabel(WorkItemAttributes.STATE);
         return prevState;
      }
   });
})();

The issue I'm facing happens when I configure the previous state custom attribute to use the work item Status as the dependency. Nothing happens. I can change the work item state as many times as I want, but the previous state custom attribute won't change. Now if I change the dependecy to some other work item attribute, such as Description or Owner, the script works fine and stores the work item current state.
I tried using the work item Modified attribute, but it didn't work either. Is my script missing anything? Or using the work item Status as a dependency is not supported?
BTW I'm running RTC 5.0.2 iFix019.

Thanks!

One answer



permanent link
Ralph Schoon (63.1k33645) | answered May 09 '17, 10:47 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 Not as far as I can tell. The state changes AFTER the save. You can use it as a dependency, but I think it would not trigger anything. The action selected by the user is only exposed to conditions (as explained in the documentation). This makes it pretty impossible to detect state changes. You can store the previous state in a hidden attribute, but that ALSO only works as dependency after the save has actually happened. 

Your answer


Register or to post your answer.