Can I know the logic for getting incidents which is "In Progress" for last 10 days
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2024 09:55 AM
Hi Team,
Can I know the logic for getting the incidents which is "In progress" for last 10 days.
I need the background script for this.
Can Someone help me to get it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2024 10:01 AM
Hello @Roshini ,
Please find below the script -
var gr = new GlideRecord('incident');
gr.addQuery('state', '2'); // 2 is the value for "In Progress"
var tenDaysAgo = gs.daysAgoStart(10);
gr.addQuery('sys_updated_on', '<=', tenDaysAgo);
gr.query();
while (gr.next()) {
gs.log('Incident ' + gr.number + ' has been in progress for more than 10 days.');
}
If my answer solves your issue, please mark it as Accepted and Helpful based on the impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2024 10:33 AM
Thanks for your reply,
but this will be giving the incidents which is "In Progress" and not updated for last 10 days.
But my requirement is to get the list of incidents which may or may not be updated but the state is "In Progress" for last 10 days.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2024 10:09 AM
Hi @Roshini
You can try the below script:
var gr = new GlideRecord('incident');
gr.addQuery('state', '2');
gr.addEncodedQuery('sys_updated_onRELATIVEGT@dayofweek@ago@10');
gr.query();
while (gr.next()) {
gs.print('Incident Number: ' + gr.number + ' | Updated On: ' + gr.sys_updated_on);
}
Thanks and Regards
Sai Venkatesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2024 10:38 AM
but this will be giving the incidents which is "In Progress" and not updated for last 10 days.
But my requirement is to get the list of incidents which may or may not be updated but the state is "In Progress" for last 10 days.