Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Need help debugging a script for attribute customizations

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";
                  
    }
});
})();

0 votes



2 answers

Permanent link
Please see https://jazz.net/library/article/1093 lab 5 for hints on how to log and debug scrips.

0 votes


Permanent link
Please see https://jazz.net/library/article/1093 lab 5 for hints on how to log and debug scrips.

0 votes

Comments

Thanks Ralph,

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

Brad

Your answer

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

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 6,126

Question asked: Mar 05 '13, 10:07 p.m.

Question was seen: 4,899 times

Last updated: Mar 06 '13, 12:40 a.m.

Confirmation Cancel Confirm