How to Calculate time between case creation and case assignation to agent?

Pallavi pawar
Tera Contributor

Hello All,

 

How to Calculate time between case(HR Case) creation and case assignation to agent?

I want Average amount of time between case creation and case assignment. 

 

How to calculate this time?

 

Please Help!!

Thank You!!

1 ACCEPTED SOLUTION

Hi,

It seems that you are asking me to provide a solution to a task or assignment. The given formula is used to calculate the time difference between two dates, in this case, the difference between the "opened_at" and "assigned_to" fields in ServiceNow.

To add a formula field to a report, follow these steps:

  1. Navigate to the report that you want to add the formula field to.

  2. Click the "Edit" button to enter report editing mode.

  3. Click the "Add Field" button to add a new field to the report.

  4. In the "Field Type" dropdown, select "Formula".

  5. Give the field a name, such as "Time to Assign".

  6. In the "Formula" field, enter the following script:

    gs.dateDiff(gs.dateFromFormat(current.opened_at, 'yyyy-MM-dd HH:mm:ss'), gs.dateFromFormat(current.assigned_to, 'yyyy-MM-dd HH:mm:ss'), true)

  7. Click "Save" to save the field and exit report editing mode.

Once you have added the formula field, it should display the time difference between the "opened_at" and "assigned_to" fields in the report.

 

Thanks,

Rahul kumar

If my response helped please mark it correct and close the thread.

Thanks,
Rahul Kumar

View solution in original post

6 REPLIES 6

Hi,

It seems that you are asking me to provide a solution to a task or assignment. The given formula is used to calculate the time difference between two dates, in this case, the difference between the "opened_at" and "assigned_to" fields in ServiceNow.

To add a formula field to a report, follow these steps:

  1. Navigate to the report that you want to add the formula field to.

  2. Click the "Edit" button to enter report editing mode.

  3. Click the "Add Field" button to add a new field to the report.

  4. In the "Field Type" dropdown, select "Formula".

  5. Give the field a name, such as "Time to Assign".

  6. In the "Formula" field, enter the following script:

    gs.dateDiff(gs.dateFromFormat(current.opened_at, 'yyyy-MM-dd HH:mm:ss'), gs.dateFromFormat(current.assigned_to, 'yyyy-MM-dd HH:mm:ss'), true)

  7. Click "Save" to save the field and exit report editing mode.

Once you have added the formula field, it should display the time difference between the "opened_at" and "assigned_to" fields in the report.

 

Thanks,

Rahul kumar

If my response helped please mark it correct and close the thread.

Thanks,
Rahul Kumar

Hi @Pallavi pawar,

In addition to above reply, to calculate the time between case creation and case assignment to agent, you can follow these steps:

1. Create a new report in ServiceNow and select the table "HR Case".
2. Add the "Opened at" field and "Assigned to" field to the report.
3. Add a new column to the report and use the "Script" option to create a script that calculates the time between case creation and case assignment.

Here's an example script:

VamsheedharRao_0-1682322782143.png

 

4. Save the script and run the report to get the average time between case creation and case assignment.

Note: This script assumes that the "Opened at" field and "Assigned to" field are both in the default format of "yyyy-MM-dd HH:mm:ss". If the fields are in a different format, you'll need to adjust the script accordingly.



Please mark correct/helpful, if your query is addressed and/or answered correctly.


Thanks,
Vamshi