It's all about the answers!

Ask a question

Does anyone know why an attribute customization for calculated value would throw an error when trying to get the Resolution attribute?


Jamie Berry (14013080) | asked Jan 30 '17, 1:05 p.m.

 I have a script based calculated value attribute customization for the corrected estimate field that is marked as dependent on the Status, Resolution, and Time Spent fields.  The script retrieves the current value of the corrected estimate field along with the state, time spent, and type values.  It then does some checks based on type to see if we want to set the corrected estimate to 0.  For two of our types, we do a further check for the Closed state.  When closed, we check the Resolution field for specific values.


We have noticed that the server log contains a large number of errors from the Script Engine related to this attribute customization.  The error states: "Attempting to get unset feature: InternalResolution".

When I first encountered this, I realized my script was attempting to retrieve the Resolution attribute for every work item regardless of state.  I then moved the call to get the Resolution value inside the if block that checked type/state thinking maybe it was due to the fact that the Resolution attribute isn't accessible in every state.   We are still receiving the error.

Does anyone know why we might be getting the "Attempting to get unset feature" error?  I have tried querying in jazz.net, but had no luck.

My script is:
-----------------------------------
dojo.provide("com.gdc4s.rtc.ValueProvider.CorrectedEstimateZero");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;

    dojo.declare("com.gdc4s.rtc.ValueProvider.CorrectedEstimateZero", null, {

        getValue: function(attribute, workItem, configuration) {
          var cest = workItem.getValue(WorkItemAttributes.CORRECTED_ESTIMATE);
          var state = workItem.getValue(WorkItemAttributes.STATE);
          var tspent = workItem.getValue(WorkItemAttributes.TIME_SPENT);
          var rtype = workItem.getValue(WorkItemAttributes.TYPE);
 
          var zeroIt = 0;
 
          / Check to see if the type/state pairing is one we care about /
          /  Task ==> Invalid (.s4)  Problem/Enhancement ==> Closed (.s7) and Resolution not Fixed (r1 / 1) or Fixed Upstream (r8 / 8) /
          if ((rtype == "task") && (state == "4" || state.lastIndexOf("s4") > -1)) {
            zeroIt = 1;
          }
          if ((rtype == "defect" || rtype == "problem" || rtype == "enhancement") && (state.lastIndexOf("s7") > -1)) {
            var resolution = workItem.getValue(WorkItemAttributes.RESOLUTION);
            if (resolution != "r1" && resolution != "1" && resolution != "r8" && resolution != "8") {
              zeroIt = 1;
            }
          }
          if (zeroIt == 1) {
            if (tspent > 0)
            {
              cest = tspent;
            }
            else
            {
              cest = 0;
            }
          }
          
          return cest;
        }
    });
})();
--------------------------

Thank you,
Jamie.

Be the first one to answer this question!


Register or to post your answer.