Report for priority of incidents
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 10:06 PM
Hi All,
I have a requirement to pull the details of the incident whose priority is downgraded.
for example :
if the priority downgraded from P1 to P2 , P3 to P4, or P1 to P4.
so i need the details of those incidents whose priority had been changed and downgraded,
could you please provide any suggestion on this
thanks
sid
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 10:18 PM
I think you can write a script include to get the required incident and return the sysids, And call the script include in report filter condition like sysid in new scriptInclude().functionName()
Sample Script include:
var downgradedIncidentSysIds = []; // Array to store sys_ids of downgraded incidents
// Query incidents where priority has been downgraded
var gr = new GlideRecord('incident');
gr.addEncodedQuery('active=true^priorityIN1,2,3,4'); // Filter active incidents with specified priorities
gr.query();
while (gr.next()) {
var oldPriority = gr.priority.getPreviousValue(); // Get the previous priority value
var newPriority = gr.priority.getValue(); // Get the current priority value
// Check if the priority has been downgraded
if (newPriority > oldPriority) {
// Store the sys_id of the downgraded incident
downgradedIncidentSysIds.push(gr.sys_id);
}
}
// Return the array containing sys_ids of downgraded incidents
return downgradedIncidentSysIds;
}
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2024 01:46 AM - edited 04-18-2024 01:46 AM
Hi @siddharth26 ,
There is nothing such called getPreviousValue() function. Can you justify why script include ?
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 10:22 PM
Hello,
Please refer below discussions.
https://www.servicenow.com/community/platform-analytics-forum/how-to-run-report-on-priority-changes/...
https://www.servicenow.com/community/developer-forum/how-to-pull-a-report-on-incident-table-for-prio...
If my answer helped you in any way please mark it as correct or helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 10:56 PM
Hi @siddharth26 ,
This can be captured by a metric definition for the priority field, but not that this solution requires 3 metrics (one for each priority).
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Best regards
Anders
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/