
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2017 08:55 AM
I want a field to display the difference between two times in minutes.
Eg: Business Duration = 136
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2017 11:00 AM
Hello Santhana
Please try below. g_form doesnot work server side
(function calculatedFieldValue(current) {
var dateString1 = new GlideDateTime(current.begin); //make sure variable name is begin
var dateString2 = new GlideDateTime(current.end); // make sure variable name is end
var diffSeconds = gs.dateDiff(dateString1, dateString2, true);
diffMins = diffSeconds/60;
return Math.round(diffMins); // return the calculated value
})(current);
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2017 11:16 AM
If your values are subjected to changes, you can create a On change client script and put the result value in your required feild using g_form.setValue()
Please mark my response as correct and helpful if it helped solved your question.
-Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2017 11:23 AM
These don't frequently change. These fields will be used post incident from a reporting perspective.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2017 11:28 AM
Ok then you can configure a BR
Please mark my response as correct and helpful if it helped solved your question.
-Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2017 09:27 AM
Hi Santhana,
Try below code, replace list line with your table name which you want to achieve.
var gr = new GlideRecord('Table Name');
gr.addQuery('active',true);
gr.query();
while(gr.next())
{
var holder = gs.dateDiff(gr.getDisplayValue('begin'), gr.getDisplayValue('end'),false) ;
holder = holder.split(' ')[1];
gs.print(holder);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2017 09:49 AM
You can set the 'max_units' attribute in that field's dictionary record. Add this attribute: max_unit=minutes