How to automate for notifying if a task isopened

Priyadarshini2
Tera Contributor

I want to send notification mail reminding that a task is opened. The mail should be sent every 6 hours until the task is closed. Please help its urgent

7 REPLIES 7

Siddhesh Gawade
Mega Sage
Mega Sage

Hello @Priyadarshini2 ,

 

You can use scheduled job, which will run on every 6 hour duration. 

 

1. Create a new event from System Policy > Events > Event Registry. for example (sc_task.not_closed).

 

2.in schedule job script you can write similar code as given and modify it according to your requirement:

 

var gr = new GlideRecord('sc_task');  // user your task table
    
    // Query open tasks (tasks that are not closed)
    gr.addQuery('state', '!=', 3); // Assuming 3 is the "Closed" state (change as per your instance's configuration)
    gr.query();

    // Loop through all open tasks
    while (gr.next()) {
        // Trigger the event if the task is still open
        gs.eventQueue('sc_task.not_closed', gr, gr.sys_id, gs.getUserID());
    }

 

 

Go to System Notification > Notifications.

  • Create a New Notification:
  • Click New to create a new notification.
    • Set the following fields:
      • Name: Task Not Closed Notification
      • Table: sc_task
      • Active: Check this box to enable the notification.
      • When to send: Set this to trigger when the event is fired.
        • Event Name: sc_task.not_closed

Who will receive: Choose who will receive the notification. This could be the task owner or any other user/group. For instance, use the Assigned to field (Modify as per your requirement).

 

Kindly mark the answer ✔️ Correct or Helpful ✔️ If it addresses your concern.


Regards,

Siddhesh

 

Ankur Bawiskar
Tera Patron
Tera Patron

@Priyadarshini2 

why not use flow designer with no-code, low-code solution?

Something like this

AnkurBawiskar_1-1742221482989.png

 

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

@Priyadarshini2 

Hope you are doing good.

Did my reply answer your question?

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