Change Request started outside planned window (Metric Definition support)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2023 02:29 AM
Hi all,
I've been trying to script a metric definition for just over 8 hours now, but for the life of me cannot get it working as intended. Is anyone that's more experienced able to help me out, please?
Requirement:
When a change request is started outside of the planned change window, then a metric instance is to be recorded, recording the change request number, date/time of event, and any other details that might be useful.
The fields I have identified to achieve this are:
- [change_request].work_start = This is the actual start date and time when the change actually took place
- [change_request].start_date = This is the planned start date and time when the change was planned to start
- [change_request].end_date = This is the planned end date and time when the change was planned to end
My pseudo code is the following:
--This accounts for changes that started before the planned start or after the planned end
If (work_start < start_date || work_start > end_date) {
//RECORD METRIC INSTANCE
}
Any help greatly appreciated. Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2023 03:00 AM
Hi @SB87
Greetings!!
You can simple report for this.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2023 03:06 AM
Thanks for your reply, but reporting from inside the tool is not an option for me. This is to support external reporting done outside of ServiceNow where we have access to data in the [metric_instance] table.
I suppose my question is more around "how to write the script" using the fields I have listed to meet the requirement.
Many thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2023 03:09 AM
Hi @SB87
Check these link to get the basic idea mate.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************