how to send a email notification if ticket has not been updated for 3 business days
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2023 11:52 PM
Hello,
I want to trigger a email notification if ticket not updated for 3 business days. for this I'm using schedule job to send the notification. can someone help me with script?
Thanks in advance!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2023 03:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2023 05:07 AM
Did you consider using a Flow? You can use a wait action, and attach a business schedule as per your requirements.
I would implement two parallel branches - one to wait for a condition (for something that makes you recognize the update), and one branch to wait for the given amount of time. If the first branch is hit earlier, it can end the Flow. If the second one comes into place, it can trigger the notification and then end the Flow.
That way, you have it individually per ticket, and it will be triggered exactly after the defined time and not somewhen in the middle of the night when you let the scheduled job run.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2023 05:09 AM
- Create a Scheduled Job: Create a scheduled job that runs on a daily basis during business days. Here's an example script for the scheduled job:
// Scheduled Job: Check Overdue Tickets
(function run() {
// Get the current date and time
var now = new GlideDateTime();
// Calculate the date 3 business days ago
var overdueDate = new GlideDateTime();
overdueDate.addDaysLocalTime(-3);
// Create a query to find tickets that haven't been updated for 3 business days
var gr = new GlideRecord('incident'); // Replace 'incident' with the appropriate table name
gr.addQuery('active', true);
gr.addQuery('state', '!=', 'closed');
gr.addQuery('last_updated_on', '<', overdueDate);
gr.query();
// Iterate over the overdue tickets
while (gr.next()) {
// Send an email notification
gs.eventQueue('send_overdue_notification', gr, gr.number, gr.short_description, gr.assigned_to.email);
}
})();
For asking ServiceNow-related questions try this :
For a better and more optimistic result, please visit this website. It uses a Chat Generative Pre-Trained Transformer ( GPT ) technology for solving ServiceNow-related issues.
Link - https://nowgpt.ai/
For the ServiceNow Certified System Administrator exams try this :
https://www.udemy.com/course/servicenow-csa-admin-certification-exam-2023/?couponCode=NOW-DEVELOPER