Notification firing multiple times

Ankit28
Kilo Contributor

The business rule Abandon and Restart Notifications script is defined as:

if ( current.state == '3' && current.u_state_reason == 'cancelled' && current.approval == 'cancelled')
{
gs.eventQueue("change.abandon", current, current.requested_by);
}

The above snippet is set to fire an event for the notification to the requester and the assigned to person if the Change Activity has been Abandon.

The main issue here is that the notification is firing multiple times, Is this a bug in Service Now?

7 REPLIES 7

Inactive_Use309
Mega Expert

It will be difficult to tell from the information provided. I have seen instances where an email message gets picked up multiple times and sent out, but this was in Aspen (and before), it was also a very rare occurance (4 times in 3+ years of use).

You should take a look at your email log for the message(s) in question. Do entries show up multiple times for the same message? if so, then you are probably having the above code executed multiple times. If it only shows up once, then you should gather the emails and submit a ticket on HI so that ServiceNow support can take a look at it. If it shows up mutiple times, then you need to look at what could be triggering your script to run multiple times.


NeilH2
Giga Guru

I'd have a look at the event log as well if you can pinpoint what events are being fired at the same time as this one it would help you narrow the search


geoffcox
Giga Guru

There is an option on the email notification to send the email to the requester. You also have specified the requester in one of your arguments to the gs.eventQueue. So maybe your notification is already sending the email to the requester, plus to the person in the argument, thus causing it to be sent twice.

Look in your email log to see if the same address was included twice on the outgoing email.

If, on the otherhand, multiple email records are showing up in the log, then I expect stolm was correct, and your code is executing multiple times. What table is the business rule on? Is it an after update rule? Maybe it's a before update rule and you're accidentally calling current.update() from inside the rule.

I hope this helps.

Cheers,
Geoff.


kedarnath13
Kilo Explorer

here is checklist for you

1)are multiple events firing?if yes then the code is running multiple times.you can cross verify adding log or addinfomessage also.

2)are there multiple notifications mapped to same event?

3)in sys_mail from, we can add a list and can see from which event it the mail was triggered.

Thanks