Convert 'Pause' Duration field to Date/Time field in Task SLA Table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 03:55 AM
Hi All,
I see that in the xml of 'Pause Duration' field for task SLA table, it shows as below:::
But when I see it in an attached Catalog Task form, it shows 38seconds.
Is there any way to convert the same into the format as shown in the first screen shot?
I was trying it like this, but is giving a blank result:::
var grtaskSla = new GlideRecord('task_sla');
grtaskSla.addQuery('task', RecID);
grtaskSla.setLimit(1);
grtaskSla.query();
if (grtaskSla.next()) {
var pauseD = grtaskSla.getDisplayValue('pause_duration');
var newPauseD = GlideDateTime(pauseD);
gs.info("Pause Duration: " + newPauseD);
}
Regards,
Saurabh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 06:36 AM - edited 12-20-2023 06:37 AM
Hi @chatsaurav19 ,
Please understand that Pause Duration is not a date type field, it's duration type which hold the calculated time difference of two datetime objects and keep adding them if the same record move multiple time in paused status.
In your script, you can print the same value from duration filed ( as given in xml )
var pauseD = grtaskSla.pause_duration;
gs.info("Pause Duration: " + pauseD );
but passing this duration in GlideDateTime() is not good idea, it will not give any result except run time error.
-Thanks,
AshishKMishra
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution