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

Ankit28
Kilo Contributor

As per the suggestions, I have tried to remove redundant settings without any luck. I have also checked the event and email logs but not able to figure out the issue. Can you please check the attachment and provide me with information.


geoffcox
Giga Guru

It looks like your business rule is being executed twice.
To confirm: Please add the following debug statement so that your business rule looks like this:


gs.log('=============== TEST - Change Request ' + current.number + ' has been updated. ============');
if (current.state == '3' && current.u_state_reason == 'cancelled' + current.approval == 'cancelled') {
gs.eventQueue('change.abandon', current, current.requested_by);
}


Then examine your system log after you cancel the ticket. If you see the debug output twice, then you know something else is up.

You may have to study any other business rules on change_request. Especially be on the lookout for a call to current.update() inside a before update business rule.

Please let me know what happens. gcox@verisign.com


Ankit28
Kilo Contributor

Okay the problem has now been fixed by doing modifications in business rule. The modified business rule is as below:

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