Calculate time to close on software task

brittney_larson
Kilo Explorer

Hello Everyone,

I am trying to determine the length of time it takes to complete a software installation task in PA. We do not have an SLA set up for the Task, RITM, or REQ related to software installs. I can manually determine the time to install from Closed Time - Open Time but I am unsure how to do this in PA. Does anyone have any recommendations or ideas?

The table I am using is sc_task. The task is created from the RITM after the REQ is approved.

Thank you,

Brittney

3 REPLIES 3

rlatorre
Kilo Sage

There are two OOB fields on the task table. "Duration" and "Business Duration". If these are not being populated for catalog tasks you can create a Business Rule to run on closure of a task to calculate the duration.



Using DurationCalculator to compute a simple duration


Using DurationCalculator to calculate a due date


pieter_goris
ServiceNow Employee
ServiceNow Employee

Hi Brittney,



please take a look at the OOB indicator 'summed duration of resolved incidents'. This is using a PA script ('Incident.ResolveTime.Hours') that is based on a start and an end date. You can apply the same logic to your indicator.



The PA script looks like:


Incident.ResolveTime.Hours _ ServiceNow 2016-09-05 15-48-13.png


So for your script, in the source section set the right table (1) and the start and end date (2) from that table that you will reference in your script.


Next in the script section, copy the script above and replace the start and end date with the ones form your table. Make sure to use the column names in the script and not the label names of the fields.*



The difference between two dates is calculated in milliseconds. That's why on the second line of the script, the result is divided by (60 * 60 * 1000) to re-calculate to hours. You can change this to your own likings.



Hope this helps.



Cheers, Pieter



* an easy way to retrieve the column names is when in list view of the PA scripts:


Scripts _ ServiceNow 2016-09-05 15-56-02.png


Hi Pieter,



If we aren't currently collecting Duration or Business Duration on these tasks, will this still work? Because I have tried copying the PA Script prior to posting this without success.



Thanks,


Brittney