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";
}
});
})();
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
Please see https://jazz.net/library/article/1093 lab 5 for hints on how to log and debug scrips.
Please see https://jazz.net/library/article/1093 lab 5 for hints on how to log and debug scrips.