Multiple Notifications Triggered When Using gs.eventQueueScheduled() in Business Rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi all,
I have a requirement to send two email notifications for Change Requests of type Normal:
When the Implementation Start Date is reached
When the Implementation End Date is reached
I'm using a Business Rule that triggers an event using gs.eventQueueScheduled() at the scheduled time. The logic works as expected, and the notifications are sent at the correct time.
However, the issue is that the notification is being triggered more than once, causing duplicate emails.
Can anyone please suggest why this may be happening and how to ensure the event/notification is triggered only once?
Thanks in advance for your inputs!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
8 hours ago
Hello @SREEKANTH_P
Since you're using an 'After Update' Business Rule, is there anything in the system (like a script, Flow, or another Business Rule) that might be updating the record again after it's saved? That could be triggering the rule multiple times and causing duplicate notifications.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago
The duplicates are happening because every time your Business Rule fires you call gs.eventQueueScheduled() without first checking whether there’s already an unsent (sysevent.state = ready) event for that same event name, table and record, so as a best practice before scheduling a new one run a GlideRecord query on the sysevent table filtering by state = ready, your event name, table = current.getTableName(), instance = current.sys_id, delete all matching ready events, and then call gs.eventQueueScheduled so you guarantee only one pending event exists at a time, effectively preventing duplicate emails.......
If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago
Try updating the condition as
State [Changes to] Scheduled
💡 If my response helped, please mark it as correct ✔️ and close the thread 🔒 — this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader