Script Fails to run at all.
![]()
I have a Modified Date initiated script that does not give us any output to the Console. It is a calculated value. We are calling script from a Workitem Attribute that is a small-string data type, but we can't get any response from the script once it is called. Can someone please help?
// The script name must be the same in lines 1 and 8. // This script needs to be modified to make it stop calculating when the state is set to "closed" dojo.provide("org.example.calculated.AgeValueProvider"); dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes"); dojo.require("dojo.date.stamp"); (function() { var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes; var fromISOString = dojo.date.stamp.fromISOString; dojo.declare("org.example.calculated.AgeValueProvider", null, { getValue: function(attribute, workItem, configuration) { var creationDate = fromISOString(workItem.getValue(WorkItemAttributes.CREATION_DATE)); var resolutionDate = fromISOString(workItem.getValue(WorkItemAttributes.RESOLUTION_DATE)); console.log("creation date" + creationDate); console.log("Resolution date" + resolutionDate); if(resolutionDate !== null){ var ageInSeconds = (resolutionDate.getTime() - creationDate.getTime()) / 1000; var days = parseInt(ageInSeconds / 86400); var hours = parseInt((ageInSeconds-days * 86400) / 3600); var minutes = parseInt((ageInSeconds-days * 86400 - hours * 3600) / 60); return days + " d, " + hours + " hr, " + minutes + " min"; }else{ var ageInSeconds = (Date.now() - creationDate.getTime()) / 1000; var days = parseInt(ageInSeconds / 86400); var hours = parseInt((ageInSeconds-days * 86400) / 3600); var minutes = parseInt((ageInSeconds-days * 86400 - hours * 3600) / 60); return days + " d, " + hours + " hr, " + minutes + " min"; } return ""; } }); })(); |
Accepted answer
![]()
Hi, Kenneth
I tested with v5.0.2 with your javascript(add a small string attribute for the calculated value) ![]() what version did you test with and what result did you get? Kenneth Herrscher selected this answer as the correct answer
|
2 other answers
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.
Comments
You should be able to use a debugger or look at the logs to get an idea. See Process Enactment Workshop for the Rational solution for Collaborative Lifecycle Management Lab 5