- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2024 11:54 PM
Hi All,
We have a requirement where we need to send a one time email notification to all assigned to users of Active HR case.
This should be done at 12:00 am informing about some new Portal feature we added.
It can be one email for every one or each email to an individual.
Could you please help me how to achieve this
Thank you
Uttam Sai S
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 01:25 AM
Sure, you can achieve this by creating a scheduled job in ServiceNow that will run at 12:00 am and send an email notification to all assigned users of active HR cases. Here are the steps:
1. Create an Email Notification:
- Navigate to System Notification > Email > Notifications.
- Click on New to create a new notification.
- Fill in the necessary details like Name, User, etc.
- In the "Send to" field, select "Specific Users".
- In the "Specific User" field, you will later dynamically add the users.
- In the "Message HTML" field, add the content you want to send in the email.
- Save the notification.
2. Create a Scheduled Script Execution (Scheduled Job):
- Navigate to System Definition > Scheduled Jobs.
- Click on New to create a new scheduled job.
- Fill in the necessary details like Name, Run, etc.
- In the "Script" field, you will write a script to fetch all the active HR cases and the assigned users.
Here is a sample script:
javascript
var gr = new GlideRecord('sn_hr_core_case');
gr.addQuery('state', 'active');
gr.query();
while(gr.next()) {
var userID = gr.assigned_to;
gs.eventQueue('custom.event', gr, userID);
}
In the above script, 'sn_hr_core_case' is the table name for HR cases, 'state' is the field name for the state of the case, 'active' is the state of the case, 'assigned_to' is the field name for the assigned user, and 'custom.event' is the event name that will trigger the email notification.
3. Update the Email Notification:
- Navigate to System Notification > Email > Notifications.
- Open the previously created notification.
- In the "When to send" field, select "Event is fired".
- In the "Event name" field, add the event name 'custom.event'.
- Save the notification.
4. Test the Scheduled Job:
- Navigate to System Definition > Scheduled Jobs.
- Open the previously created scheduled job.
- Click on "Execute Now" to test the job.
Please replace the table names, field names, and event name with the actual ones used in your instance.
nowKB.com
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 01:58 AM
Sure, you can achieve this by creating a scheduled job in ServiceNow that will run at 12:00 am and send an email notification to all assigned users of Active HR cases. Here are the steps:
1. **Create an Email Notification:**
- Navigate to System Notification > Email > Notifications.
- Click on New to create a new notification.
- Fill in the necessary details like Name, User, Subject, Message etc.
- In the "Who will receive" section, select "Specific Users" and leave the field blank for now as we will be adding users dynamically through script.
- Save the notification.
2. **Create a Scheduled Script Execution (Scheduled Job):**
- Navigate to System Definition > Scheduled Jobs.
- Click on New to create a new scheduled job.
- Fill in the necessary details like Name, Run, Next action time etc.
- In the "Script" field, write a script to fetch all active HR cases and the assigned users. Then, trigger the email notification created in step 1 for each user.
Here is a sample script:
javascript
var hrCaseGr = new GlideRecord('sn_hr_core_case');
hrCaseGr.addQuery('active', true);
hrCaseGr.query();
while (hrCaseGr.next()) {
var assignedToUser = hrCaseGr.getValue('assigned_to');
if (assignedToUser) {
gs.eventQueue('custom.event', hrCaseGr, assignedToUser);
}
}
In this script, 'sn_hr_core_case' is the table name for HR cases, 'active' is the field name for active cases, 'assigned_to' is the field name for assigned users, and 'custom.event' is the name of the email notification created in step 1.
3. **Set the Scheduled Job to run at 12:00 am:**
- In the "Run" field of the scheduled job, select "Periodically".
- In the "Time" field, set it to 12:00 am.
- Save the scheduled job.
This will send an email notification to all assigned users of active HR cases at 12:00 am every day.
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.
Please visit : https://nowkb.com/home
Our Website :https://nowkb.com/home
Link - https://nowgpt.ai/

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2024 11:58 PM
Hi,
Please check below link and try something from your end.
Let us know if you get stuck.
https://www.servicenow.com/community/spm-forum/creating-a-scheduled-notification/m-p/991896
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 01:00 AM
Hi @Uttam Sai ,
Refer below link
https://www.servicenow.com/community/developer-forum/creating-schedule-job-to-send-notification/m-p/...
Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 01:25 AM
Sure, you can achieve this by creating a scheduled job in ServiceNow that will run at 12:00 am and send an email notification to all assigned users of active HR cases. Here are the steps:
1. Create an Email Notification:
- Navigate to System Notification > Email > Notifications.
- Click on New to create a new notification.
- Fill in the necessary details like Name, User, etc.
- In the "Send to" field, select "Specific Users".
- In the "Specific User" field, you will later dynamically add the users.
- In the "Message HTML" field, add the content you want to send in the email.
- Save the notification.
2. Create a Scheduled Script Execution (Scheduled Job):
- Navigate to System Definition > Scheduled Jobs.
- Click on New to create a new scheduled job.
- Fill in the necessary details like Name, Run, etc.
- In the "Script" field, you will write a script to fetch all the active HR cases and the assigned users.
Here is a sample script:
javascript
var gr = new GlideRecord('sn_hr_core_case');
gr.addQuery('state', 'active');
gr.query();
while(gr.next()) {
var userID = gr.assigned_to;
gs.eventQueue('custom.event', gr, userID);
}
In the above script, 'sn_hr_core_case' is the table name for HR cases, 'state' is the field name for the state of the case, 'active' is the state of the case, 'assigned_to' is the field name for the assigned user, and 'custom.event' is the event name that will trigger the email notification.
3. Update the Email Notification:
- Navigate to System Notification > Email > Notifications.
- Open the previously created notification.
- In the "When to send" field, select "Event is fired".
- In the "Event name" field, add the event name 'custom.event'.
- Save the notification.
4. Test the Scheduled Job:
- Navigate to System Definition > Scheduled Jobs.
- Open the previously created scheduled job.
- Click on "Execute Now" to test the job.
Please replace the table names, field names, and event name with the actual ones used in your instance.
nowKB.com
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2024 09:51 AM