It's all about the answers!

Ask a question

Need help debugging a script for attribute customizations


bradley ebert (133) | asked Mar 05 '13, 10:07 p.m.
Hello RTC scripting guru's,

Below is a script that I am using to try a change the value of "status_action_item" based on whether the "assigned_date" is past "test_date_1", if the "assigned_date" is before the test_date_1, set the "status_action_item" to "Open", if not set the value to "Overdue".  Currently, it seems to get hung up before even reaching the if-else statement, the only value that shows up is the default value set in the enum definition for "status_action_item".  I am invoking this script from the "Calculated Values" section in the process configuration.

RTC 4.0.0

Thank you in advance,
Brad Ebert


dojo.provide("org.example.workitems.providers.status_action_item");

dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
dojo.require("dojo.date");
dojo.require("dojo.date.stamp");

(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;

dojo.declare("org.example.workitems.providers.status_action_item", null, {

    getValue: function(attributeId, workItem, configuration) {

        // Get the assigned date and the due date and compute the difference in days.
        
        var assignedDate= dojo.date.stamp.fromISOString(workItem.getValue(WorkItemAttributes.assigned_date));
        var dueDate= dojo.date.stamp.fromISOString(workItem.getValue(WorkItemAttributes.test_date_1));
        var dayDiff= dojo.date.difference(assignedDate, dueDate, "day");
       
        // Return a string that indicates whether the work item is open or overdue
          
              if (dayDiff < 0)  return "Open";
                 else return "Overdue";
                  
    }
});
})();

2 answers



permanent link
Ralph Schoon (63.5k33646) | answered Mar 06 '13, 12:29 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Please see https://jazz.net/library/article/1093 lab 5 for hints on how to log and debug scrips.

permanent link
Ralph Schoon (63.5k33646) | answered Mar 06 '13, 12:29 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Please see https://jazz.net/library/article/1093 lab 5 for hints on how to log and debug scrips.

Comments
bradley ebert commented Mar 06 '13, 12:40 a.m.

Thanks Ralph,

this looks good, I will see if this helps me in developing my scripts.

Brad

Your answer


Register or 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.