Catalog Task Duration

turnea
Mega Expert

Hi everyone,

 

We are currently trying to run reports on our sc_task table and we noticed that there is a "Duration" column that does not populate any information.   The way we deal with duration right now is by exporting to excel and doing the calculation manually, but it would be nice to have that column do it for us.   Currently we do not have SLAs within Service Request just because of the multitude of items with varying time frames.   Is there a way to find the column and get it to calculate?   I didn't notice is in the Dictionary but may have missed it.   We're using Berlin if that helps any.

 

Any help would be appreciated.

 

Thank you!

3 REPLIES 3

RichardSaunders
Tera Guru

We would also like some tips on enabling this function for Catalogue Tasks.


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

RichardSaunders
Tera Guru

Hi Amanda,



If you are still looking for a solution, i found another thread here.



Catalog Task (up-to-the-minute) Aging Report



Quoted from the above post by Travis Toulson



Not a problem.   I would actually create a new field rather than using the Duration field itself.   Here's the approach:



1.   Personalize the form


2.   From the Create New Field in the bottom right, select Duration from the type and give the field a name


3.   Click Add to add the field to the form, position it and click Save


4.   From the form, right click the field and click Personalize Dictionary.


5.   Click the Read Only checkmark, click the Calculated checkmark


6.   In the calculated field, enter the following:


gs.dateDiff(current.opened_at.getDisplayValue(), new GlideDateTime().getDisplayValue());



That ought to work.



This calculates it from the time started until current.



I swapped the last step with this



gs.dateDiff(current.opened_at.getDisplayValue(), current.closed_at.getDisplayValue());



to give you the duration of a task opened to closed.



I hope that helps.