Notification to Assignee to

vivek110
Tera Contributor

Hi All,
We have one requirement to send the notification to "Assigned to" if the incident is not updated for more than 6 hrs since the time it is assigned to him.
Can you help me to resolve this?

I have tried scheduled job and also Flow designer but not able to get this.

 

Regards,

Vivek

6 REPLIES 6

Community Alums
Not applicable

Hello @vivek110 

You can achieve this requirement by creating a scheduled job that checks for incidents not updated within the specified time frame and then sends a notification. Here's a step-by-step guide to help you set this up:

1) Create a Scheduled Job:

  • Navigate to System Definition > Scheduled Jobs.
  • Click on New to create a new scheduled job.
  • Set the Run field to a suitable interval (e.g., every hour).

2) Define the Script:

  • In the script section, write a script to find incidents that have not been updated for more than 6 hours. Here's an example script:

 

var gr = new GlideRecord('incident');
gr.addQuery('state', '!=', 'Closed'); // Ensure the incident is not closed
gr.addQuery('sys_updated_on', '<=', gs.minutesAgo(360)); // 360 minutes = 6 hours
gr.query();

while (gr.next()) {
    // Check if the incident has been assigned and not updated by the assigned person
    if (gr.assigned_to && gr.sys_updated_by != gr.assigned_to) {
        // Send notification
        gs.eventQueue('incident.inactivity.notification', gr, gr.assigned_to, gs.getUserID());
    }
}

 

3) Create a Notification:

  • Navigate to System Notification > Email > Notifications.
  • Click on New to create a new notification.
  • Set the When to send field to the custom event you defined in the script (e.g., incident.inactivity.notification).
  • Define the Who will receive field to Assigned to.
  • Customize the What it will contain section to include relevant information about the incident.

If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.
Thanks & Regards
Viraj Hudlikar.

I have tried your code but it is not working

 

Community Alums
Not applicable

Hi @vivek110 ,

Can please provide snap of action and condition in flow designer, or we can acheive the these requirement by adding "Look up record" action on incident table with condition: 

polnilesh99_0-1735628757604.png

 

Ankur Bawiskar
Tera Patron
Tera Patron

@vivek110 

you can use flow designer for this

Something like this but please enhance it as per your requirement

 

flow ticket not updated.gif

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader