How set a value glide duration fields?

nthumma
Giga Guru

How to set a value for glide duration fields , below is code i am using

function onBefore(current, previous) {

  //This function will be automatically called when this rule is processed.

  gs.include('DurationCalculator');

  var time_elapsed = executeSample(current.opened_at,current.closed_at);// value i am getting back here is '324000'

  current.business_duration = time_elapsed; // this line is not working

  current.calendar_duration = time_elapsed; // this line is not working

  time_elapsed = time_elapsed.toFixed(1);

  current.description=time_elapsed;

}

any thoughts ?

Thanks in advance

1 ACCEPTED SOLUTION
7 REPLIES 7

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

function onBefore(current, previous) {


  //This function will be automatically called when this rule is processed.


  gs.include('DurationCalculator');


  var time_elapsed = executeSample(current.opened_at,current.closed_at);


  current.business_duration.setDateNumericValue(time_elapsed); // this line is not working


  current.calendar_duration.setDateNumericValue(time_elapsed); // this line is not working


  time_elapsed = time_elapsed.toFixed(1);


  current.description=time_elapsed;


}


pradeepksharma



Thanks for quick response.I tried using this before but i am getting back '0 Seconds'. (updated code above).



screen shot below for same.


Duaration_Issue.JPG


Hi,



Can you replicate this on any demo instance so that I can take a look.


I will IM you the details.


can you add me as your friend so that i can send you details?