Business rule generating duplicate event entries
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2025 04:32 AM
I'm trying to generate emails based on the below business rules that will trigger two events:
I'm using the below script:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2025 05:57 AM
You don't have any code checking to see if something is already processed. This BR runs when something changes and adds the 2 events. Then if something else changes, it will run again and process the 2 events again. There's nothing in there that checks the event queue to see if something is already there for the given emails or sys_ids. Your variables processedEmails and processedSysIds are re-created each time the BR runs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2025 06:16 AM
Hi @JenniferRah What would I need to include in the business rule script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2025 06:24 AM
Based on your latest output logs, I see that Peter has two different entries with same event that is line manager event.
If you have inserted single record and it is still triggering multiple events to same user which means most probably your system has any before/after BR with current.update() which triggers your BR twice resulting in duplicate event entries.
Regards,
Abhijit
ServiceNow MVP

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2025 06:30 AM
Maybe change your function to this? You wouldn't need the processedEmails and processedSysIds variables anymore.
function triggerEvent(eventName, email, sysId, manager) {
var gr = glideRecord('sysevent');
gr.addQuery('name', eventName);
gr.addQuery('instance', current);
gr.addQuery('parm1', email);
gr.query();
if(!gr.next()){
gs.info("gs.eventQueue('" + eventName + "', " + current + ", " + email + ")");
gs.eventQueue(eventName, current, email, manager);
}
}