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

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Priyadarshini2 

How does a task get reopened? As far as I know, once a task is closed, it should not be reopened. Please make sure to follow this practice."

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

No its not reopened. I meant, i want to send email notifications to the user until a specific task is not closed in every 6 hours duration.

Using scheduled job

Hello @Priyadarshini2 

Method#1: Scheduled Job

1. Create an Event in Event Registery (Table:sysevent_register)

vishal_jaswal_0-1742220736196.png


2. Create Scheduled Job - System Defintion > Scheduled Jobs (Table: sysauto_script)

Enter Name
Run: Periodically
Repeat Interval: Days 0 Hours 06
Run this Script:

var grTask = new GlideRecord('sc_task');
grTask.addEncodedQuery('assigned_toISNOTEMPTY^stateNOT IN3,4,7'); //is the state is not one of Closed Incomplete, Closed Complete and Closed Skipped along with assigned to is not empty. You can build this in the sc_task list view as per your requirement
grTask.query();
while (grTask.next()) {
    gs.eventQueue('sc_task.reminder_email', grTask, grTask.assigned_to.email, grTask.number);
}

vishal_jaswal_1-1742220922873.png

3. Set up e-mail notification: If you execute the above scheduled job then in the sysevent_list table you will see the value of Parm1 and Parm2. Based upon this, you can set your e-mail notification as shown below:

When to Send:

vishal_jaswal_2-1742221062104.png

 

Who will receive:

vishal_jaswal_3-1742221107272.png

 

What it will contain:

vishal_jaswal_4-1742221122268.png


4. Validation: Table: sys_email
Execute the scheduled job and you will find the sent e-mail in sys_email table:

vishal_jaswal_5-1742221240769.png

vishal_jaswal_6-1742221251931.png



Method#2: Flow (Workflow studio): No code

Flow Name
Advanced Options: Run as > System User

vishal_jaswal_7-1742221294290.png
1. Trigger:

vishal_jaswal_8-1742221357356.png


2. Actions > Look Up Records

vishal_jaswal_9-1742221383319.png

3. Flow Logic > For each - Drag and Drop Pill Catalog Task Records (under 1 - Look Up Records) from left

vishal_jaswal_10-1742221409934.png

4. Action > Send E-mail

vishal_jaswal_11-1742221482737.png



Target Record: Drag 2 - For Each > Catalog Task Record
Table: sc_task
To: Use Data Pill picker to dot walk Catalog Task Record > Assigned To > Email
Subject: your choice
Body: Your choice

Hope that helps!

 

 




 


Hope that helps!