- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2016 10:57 AM
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
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2016 10:59 AM
Hi,
Please check section 4 for more info.
http://wiki.servicenow.com/index.php?title=Setting_the_Duration_Field_Value#gsc.tab=0

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2016 10:59 AM
Hi,
Please check section 4 for more info.
http://wiki.servicenow.com/index.php?title=Setting_the_Duration_Field_Value#gsc.tab=0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2016 11:09 AM
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;
}
Thanks for quick response.I tried using this before but i am getting back '0 Seconds'. (updated code above).
screen shot below for same.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2016 11:14 AM
Hi,
Can you replicate this on any demo instance so that I can take a look.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2016 11:23 AM
I will IM you the details.
can you add me as your friend so that i can send you details?