- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2023 01:04 AM
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!!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2023 09:53 PM
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:
Navigate to the report that you want to add the formula field to.
Click the "Edit" button to enter report editing mode.
Click the "Add Field" button to add a new field to the report.
In the "Field Type" dropdown, select "Formula".
Give the field a name, such as "Time to Assign".
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)
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
Thanks,
Rahul Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2023 09:53 PM
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:
Navigate to the report that you want to add the formula field to.
Click the "Edit" button to enter report editing mode.
Click the "Add Field" button to add a new field to the report.
In the "Field Type" dropdown, select "Formula".
Give the field a name, such as "Time to Assign".
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)
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
Thanks,
Rahul Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2023 12:57 AM
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:
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