Convert 'Pause' Duration field to Date/Time field in Task SLA Table

chatsaurav19
Tera Contributor

Hi All,

 

I see that in the xml of 'Pause Duration' field for task SLA table, it shows as below:::

 

chatsaurav19_0-1703072995339.png

 

But when I see it in an attached Catalog Task form, it shows 38seconds.

 

chatsaurav19_1-1703073313172.png

 

 

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

1 REPLY 1

AshishKM
Kilo Patron
Kilo Patron

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