send mail to user of list of incidents which are not updated from one week

Priti18
Tera Expert

how can i notify user in on mail and share of list of incidents which are not updated from last one week

11 REPLIES 11

Looks like your notification is not configured correctly, could you please paste the content of the email script which you are using in the notification. Will be able to share inputs once I see the email script.

var gr = new GlideRecord('incident');

gr.addQuery('sys_updated_onRELATIVELT@dayofweek@ago@7^stateNOT IN7,8');

gr.addQuery('assignment_group=123^ORassignment_group=456');

gr.query();

var incidents = [];

while (gr.next()) {

 

    incidents.push(gr.getValue('sys_id'));

   

 

var incidentsSysId = ["123","456","789"];

    incidentsSysId = incidentsSysId.split(',');

 

var incnumbers = [];

 

for(var i = 0; i<incidentsSysId.length; i++){

    var gr = new GlideRecord('incident');

    if(gr.get(incidentsSysId[i])){

   incnumbers.push(gr.number.toString());

 

gs.print('test '+incnumbers);

}

    

Please correct this script am not able to get the desired result.

@Priti18 Where are you triggering event in this script? In order to send a notification you need to register an event in the event registry and trigger it via your script.

I used your above script where am passing the sys id of those incidents which are not updated from a week in an array as parm1 and triggering event --> this part is working i can see sysids of the records.

now these sys ids should go as a n incident number link in an email in a readable format to the user --> this is not coming so I used email script and above is the script, am not sure where is the issue in the script which i stopping it to go as link.

By email script I meant to say the script like the following which is used inside a notification to print dynamic values.

 

Screenshot 2023-03-30 at 7.51.13 PM.png

 

In the notification they are used like following.

 

Screenshot 2023-03-30 at 7.53.05 PM.png

The script you posted in reply should be used for preparing the event parameters and triggering the event.