Suddenly problem in javascript (Work item customization)
Jia jang (42●1●11)
| asked Apr 06 '17, 2:03 a.m.
edited Apr 07 '17, 1:56 p.m. by Ralph Schoon (63.5k●3●36●46) hello all ,
I have a project area based on scrum template.
I am working on work item customization . I created a custom workitem in that there are three custom attributes.
i.e. 1) actual start date
2) Actual end date
3) Total efforts
let me explain in details ,
1) actual start date ---------->current date/time is set when workitem state moved to "In progress" state.
2) actual end date ----------> current date/time is set when workitem state moved to "complete" state.
3) based on both these values (actual start date and end date) 'total efforts' are calculated immediately.
here is script for more details ...
dojo.provide("Actual3");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
dojo.require("dojo.date.stamp");
dojo.require("dojo.date");
(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
var fromISOString = dojo.date.stamp.fromISOString;
dojo.declare("Actual3", null, {
getValue: function(attribute, workItem, configuration) {
var metoo;
var currentDate= new Date();
var datum = currentDate.getDate();
var mjesec = currentDate.getMonth() + 1;
var godina = currentDate.getFullYear();
var hours = currentDate.getHours();
var minutes = currentDate.getMinutes();
var seconds = currentDate.getSeconds();
var startdate= dojo.date.stamp.fromISOString(workItem.getValue("asd"));
var state = workItem.getValue(WorkItemAttributes.STATE);
if (state.toString() == "com.ibm.team.workitem.taskWorkflow.state.s3")
{
var InSecond = (Date.now() - startdate.getTime()) / 3600000;
if(InSecond % 24 == 0)
{
if(InSecond / 24 == 1)
{
return "8 Hours";
}
if(InSecond / 24 == 2)
{
return "16 Hours";
}
if(InSecond / 24 == 3)
{
return "24 Hours";
}
if(InSecond / 24 == 4)
{
return "32 Hours";
}
if(InSecond / 24 == 5)
{
return "40 Hours";
}
if(InSecond / 24 == 6)
{
return "48 Hours";
}
}
}
else
{
var Me;
var You;
Me = InSecond % 24 ;
You = InSecond / 24 ;
var Jio = parseInt(You.toString());
You = Jio * 8 ;
return (You + Me).toString()+" Hours";
}
else
{
}
return "";
}
});
})();
****************
Please note this :- this script was working correctly from last 10/15 days , but now suddenly the output is not gonna display. I tried many times but all failed .
****************
can anyone tell me , is there is any issues about javascript ? because code is correct but suddenly not responding.
|
One answer
A conspiracy theory - double check that the state "com.ibm.team.workitem.taskWorkflow.state.s3" still exists.
Comments 1
Ralph Schoon
commented Apr 06 '17, 10:07 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
+1 Don
Jia jang
commented Apr 10 '17, 1:25 a.m.
Hi ralph,
I have debugged the script its working but require to be triggered from some other attribute(i.e summary). It is not triggered by work item state itself.
Is there any license issue ? because our trial licenses are expired , and I am working on free ccm developer license.
This is not a license problem. Attribute customization does not require a special license.
Note that the state does not change when you select the action the state would change after the save. Note that JavaScript does not have access to the action/state change. It can only access the value of the attribute.
Jonas Studer
commented Apr 10 '17, 4:00 a.m.
There's a possibility to access the workflows.
|
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
Consider to look into the log files and/or debug the script.
I am also facing this same problem.
Is their in support issue of JavaScript or else?