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

Suddenly problem in javascript (Work item customization)

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.

1 vote

Comments

Consider to look into the log files and/or debug the script. 

 I am also facing this same problem.

my script was working correctly from last 8 days , but now suddenly the output is not gonna display. I tried many times but all failed. So

Is their in support issue of JavaScript or else? 

I also go through debugging but while debugging whenever I open my script and start executing then control goes to bundle.js and vendor.js. file.  Debugging didn't look towards my script.  Is there any solution for this and is so then please tell me.



One answer

Permanent link

A conspiracy theory - double check that the state "com.ibm.team.workitem.taskWorkflow.state.s3" still exists.

0 votes

Comments

+1 Don

Also see what https://jazz.net/wiki/bin/view/Main/AttributeCustomization says about states and how to identify them.

See https://jazz.net/library/article/1360 for how debugging them works.

PS: I have debugged calculated value scripts and that works if you follow what needs to ne done.

1 vote

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. 

There's a possibility to access the workflows.

Check/Try this link:
Server: "localhost:7443/jazz"
Service: "/service/com.ibm.team.workitem.service.process.internal.rest.IWorkItemConfigRestService/workflows?projectAreaItemId="
ProjectareaItemId: "_ababababababab"

Make an XHR request to: SERVER+SERVICE+PAID
An you'll get the possbile workflow.

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
× 152

Question asked: Apr 06 '17, 2:03 a.m.

Question was seen: 2,628 times

Last updated: Apr 10 '17, 4:00 a.m.

Confirmation Cancel Confirm