send mail to user of list of incidents which are not updated from one week
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2023 07:30 AM
how can i notify user in on mail and share of list of incidents which are not updated from last one week

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2023 10:47 AM
As a part of this exercise, you need to configure three things.
1. A scheduled job (assuming you need to send this notification to your user periodically).
2. An event (will be used for triggering the notification)
3. A notification (email which will be finally sent to the user).
Here I am pasting the code of scheduled job
Here is the script to get the list of incidents which have not been updated since last one week and those which are not in closed or canceled state.
var list = new GlideRecord('incident');
list.addEncodedQuery('sys_updated_onRELATIVELT@dayofweek@ago@7^stateNOT IN7,8');//State not closed or canceled
list.query();
var incidentArray = [];
while (list.next()){
incidentArray.push(list.getValue('sys_id'));
}
gs.eventQueue('<your event>',current,incidentArray.toString(),'email@server.com');
Here <your event> is name of your event, and email@server.com will be replaced by the user's email to whom this notification needs to be sent.
Let me know in case you need any help in configuring the notification.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2023 01:28 AM
thanks sandeep with the above solution am able to get sys id of the incidents .
if i have to send the list of all those incidents in a link format in an email then what should be the approach.
for eg.
inci1
inci2 and so on.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2023 02:16 AM
Here is the updated code which generates incident links instead of the sys_ids.
var list = new GlideRecord('incident');
list.addEncodedQuery('sys_updated_onRELATIVELT@dayofweek@ago@7^stateNOT IN7,8');//State not closed or canceled
list.query();
var incidentArray = [];
while (list.next()){
incidentArray.push(gs.getProperty('glide.servlet.uri')+list.getLink(false));
}
gs.info(incidentArray.toString());
gs.eventQueue('<your event>',current,incidentArray.toString(),'email@server.com');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2023 04:47 AM
with the help of above code am getting all the links in parm 1 in the event log i can see but the mail which i received it only has one incident number in the target column and in body it has nothing.
I have checked parm1 in notification and have passed ${event.parm1} in the body part of what it will contain.
i need in this format,
hi ,
below are the incidents which need your attention:-
incident001 as a link
incident002 and so on