The CreatorCon Call for Content is officially open! Get started here.

Need to send an email with list of incidents which are not updated more than 2 days

VijayramY
Tera Contributor

Need to send an email every day with list of incidents which are not updated more than 2 days. Here trigger condition is , if any incident is not updated more than 2 days
please guide me on how to achieve this.

7 REPLIES 7

AndersBGS
Tera Patron
Tera Patron

Hi @VijayramY ,

 

 what have you tried so far? basic schedule report can do the trick.

 

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/

Shruti D
Kilo Sage

Hello @VijayramY ,

Please refer the article Weekly Incident Summary Notifications Using Flow Designer.

Here the flow designer is used for setting up the incident notification. You can modify the trigger condition and script as per your requirement.

 

 

Please Mark Correct ✔️ if this solves your query and also mark Helpful 👍 if you find my response worthy based on the impact.

 

Regards,

Shruti

vignesh parthib
Tera Guru

Hi Vijayram

 

  • You can create a schedule job , please modify below script base on you requirement.
  • Create a event registry and call event in notification trigger condition.

var twoDaysAgo = new GlideDateTime();
twoDaysAgo.subtract(2 * 24 * 60 * 60 * 1000); // subtract 2 days

var gr = new GlideRecord('incident');
gr.addEncodedQuery('sys_updated_on<javascript&colon;gs.daysAgoStart(2)^state!=7'); // Not updated in last 2 days & not closed
gr.query();

if (gr.hasNext()) {
var emailBody = "The following incidents have not been updated in more than 2 days:\n\n";

while (gr.next()) {
emailBody += "INC: " + gr.getValue('number') +
" | Short Description: " + gr.getValue('short_description') +
" | Last Updated: " + gr.getDisplayValue('sys_updated_on') +
"\n";
}

// Send the email
gs.eventQueue("custom.incident.stale.report", gs.getUser(), emailBody, null); 
}