- 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-27-2024 06:57 AM
Hi @sumanta pal ,
Thank you so much for your response .There is problem of sending the email multiple times to same recipient as the content in email is same , our requirement is to restrict this to one email per user. Is there a way we can do this.
Thank you
Uttam Sai S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 02:51 AM
Please test the solutions provided by @Anil Lande @Anand Kumar P and share feedback.
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]
****************************************************************************************************************
