It's all about the answers!

Ask a question

Can anyone help me with a Calculated Value attribute customization script for Story Points?

Jamie Berry (14013079) | asked Feb 16 '18, 4:25 p.m.

 We are attempting to write an attribute customization calculated value script to clear the story points of a Story when the Story moves to the Invalid state.  I am able to do something similar with the time spent field so I thought I could do it with Story Points.  I have written the script included below and have set it as the calculated value script for the Story Points attribute of the Story work item along wiht a Dependency on the Status field.  When I use it, I don't get any error but I also don't see the Story Points field change.  The id of the '0 pts' story point value is "0" and that is what I am returning.

Does anyone know what I am doing wrong?

(function() {
    var scriptName= "ClearInvalidStoryPoints";
dojo.declare("com.gdms.rtc.ValueProvider.ClearInvalidStoryPoints", null, {
        getValue: function(attribute, workItem, configuration) {
            var stryPts = workItem.getValue("");
            var state = workItem.getValue("");
            var rtype = workItem.getValue("");
            / Check to see if the type/state pairing is one we care about /
            /  Story ==> Invalid (.s2) */
            if ((rtype.lastIndexOf("story") > -1) && (state.lastIndexOf("s2") > -1)) {
            stryPts = "0";
          return stryPts;

Thank you,

Accepted answer

permanent link
Ralph Schoon (60.9k33643) | answered Feb 17 '18, 9:36 a.m.

As far as I am aware, story points is an enumeration. In that case you would set a specific literal that represents the null. It might be customized so you should check what it is.

It is always a good idea to check the type of an attribute before trying to customize it. It is also a good idea to look into what the application thinks are the values e.g. with the "Spy" calculated value in the enactment workshop, by logging or using debugging. All these approaches save time.

Jamie Berry selected this answer as the correct answer

Ralph Schoon commented Feb 19 '18, 7:20 a.m. | edited Feb 19 '18, 7:21 a.m.

These attribute definitions do not exist:

var state = workItem.getValue(""); var rtype = workItem.getValue("");

See for the API. You can find the work item attribute ID's in the web admin UI.

Story points is a custom attribute with ID the ID you have there.
State is "internalState" or WorkItemAttributes.STATE.
The type attribute ID is "workItemType" or WorkItemAttributes.TYPE I would suggest to follow the workshop or at least look at

Jamie Berry commented Feb 19 '18, 9:39 a.m.


  Thank you for the additional information.  I will read through the references and work on debugging my code.  I appreciate your help.


Jamie Berry commented Feb 19 '18, 5:49 p.m.


  Thank you again for the help.  I was able to clean up my script and get things to work.


Your answer

Register or to post your answer.