- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2024 09:18 AM
Hi Team ,
Can you Please guide me with below request
SNOW send a daily automated notification to requestor of the CR and his/her Manager if the CR has passed the (scheduled) planned end date and still not in any one of the below terminal state: Closed Complete, Cancelled, Closed Exceptions
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2024 09:54 AM
Hello @pramn ,
To send daily automated notification, you need to create a scheduled script execution & notification.
Create a Scheduled Script Execution
Navigate to: System Definition > Scheduled Script Executions.
Click on: New to create a new scheduled script.
Configure the Scheduled Script Execution:
- Name: Notify Requestor and Manager of Overdue CRs
- Active: True
- Run: Daily
- Time: Choose a suitable time for the script to run daily (e.g., 12:00 AM).
- Condition: Leave this blank as we will handle the condition in the script.
Script:
var gr = new GlideRecord('change_request');
gr.addEncodedQuery('planned_end_date<javascript:gs.beginningOfToday()^stateNOT IN3,4,7'); // Adjust states as per your instance
gr.query();
while (gr.next()) {
var requestor = gr.requested_by;
var manager = requestor.manager;
// Check if the manager is not empty
if (manager) {
var recipients = requestor.email + ',' + manager.email;
// Send the notification
gs.eventQueue('event_name', gr, recipients); //Pass the correct event name
} else {
// Send notification only to requestor if manager is not defined
gs.eventQueue('event_name', gr, requestor.email); //
}
}
Then register an event and configure the notification record as below -
Configure the Notification:
- Name: Overdue CR Notification
- Table: Change Request
- When to send: Event is fired
- Event name: select event.
- Who will receive: Select use the recipients from the event checkbox.
For more information please refer -
If my answer solves your issue, please mark it as Accepted✔️ & Helpful👍!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2024 11:10 PM
Hello @pramn ,
Here you go -
Navigate to System definition > Scehduled Jobs > click on New Button > Automatically run a script of your choosing
For more information on scheduled Jobs please refer -
If my answer solves your issue, please mark it as Accepted ✔️& Helpful👍!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2024 09:54 AM
Hello @pramn ,
To send daily automated notification, you need to create a scheduled script execution & notification.
Create a Scheduled Script Execution
Navigate to: System Definition > Scheduled Script Executions.
Click on: New to create a new scheduled script.
Configure the Scheduled Script Execution:
- Name: Notify Requestor and Manager of Overdue CRs
- Active: True
- Run: Daily
- Time: Choose a suitable time for the script to run daily (e.g., 12:00 AM).
- Condition: Leave this blank as we will handle the condition in the script.
Script:
var gr = new GlideRecord('change_request');
gr.addEncodedQuery('planned_end_date<javascript:gs.beginningOfToday()^stateNOT IN3,4,7'); // Adjust states as per your instance
gr.query();
while (gr.next()) {
var requestor = gr.requested_by;
var manager = requestor.manager;
// Check if the manager is not empty
if (manager) {
var recipients = requestor.email + ',' + manager.email;
// Send the notification
gs.eventQueue('event_name', gr, recipients); //Pass the correct event name
} else {
// Send notification only to requestor if manager is not defined
gs.eventQueue('event_name', gr, requestor.email); //
}
}
Then register an event and configure the notification record as below -
Configure the Notification:
- Name: Overdue CR Notification
- Table: Change Request
- When to send: Event is fired
- Event name: select event.
- Who will receive: Select use the recipients from the event checkbox.
For more information please refer -
If my answer solves your issue, please mark it as Accepted✔️ & Helpful👍!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2024 10:29 PM
Its a schedule job or scheduled script execution , i am not able to find .please help me with this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2024 11:10 PM
Hello @pramn ,
Here you go -
Navigate to System definition > Scehduled Jobs > click on New Button > Automatically run a script of your choosing
For more information on scheduled Jobs please refer -
If my answer solves your issue, please mark it as Accepted ✔️& Helpful👍!