Why event is triggering multiple time through workflow run script? Email logs received many time.

Anmol12
Tera Contributor

Hi,

I'm firing the event for a notification with below code but when I'm checking the email logs then I can seethe email logs generated many time for same notification. Is my code firing the event may time? 

 Can someone check please?

Workflow Run Script -

var approvers = [];

var getApprovers = new GlideRecord('sysapproval_approver');

getApprovers.addQuery('state', 'requested');

getApprovers.addQuery('group', current.task);

getApprovers.query();

while (getApprovers.next())

{

approvers.push(getApprovers.getValue('approver'));

}

gs.eventQueue('event,name', getApprovers, approvers, getApprovers.group.assignment_group_manager);

 

Notiication -

 

When to send - Event is fired

Who will receive - Send to Parm1

 

Please tell me why it's sending notification multiple time or event is firing multiple time?

7 REPLIES 7

Anmol12
Tera Contributor

Hi Zaib,

I am looking to trigger one notification to all recipients present under parm1. I can see same multiple log for same set of recipients. Ideally it should be only one log for all recipients 

Zaib Ali
Tera Contributor

@Anmol12 

 

 would you like to share any of the log screen shot where it's appearing the recipient field inside the log record.

 

also please validate how you triggering the workflow as well make sure the script you are calling is not under any iteration/loop.

Anmol12
Tera Contributor

@Zaib Ali I can't share log screenshots and this run script activity is in Task SLA worflow which will be applied when SLA percentage timer activity is breached up to certain percentage. This script is not under any iteration or loop. It's given as same as mentioned below in run script activity.

Workflow Run Script -

var approvers = [];

var getApprovers = new GlideRecord('sysapproval_approver');

getApprovers.addQuery('state', 'requested');

getApprovers.addQuery('group', current.task);

getApprovers.query();

while (getApprovers.next())

{

approvers.push(getApprovers.getValue('approver'));

}

gs.eventQueue('event,name', getApprovers, approvers, getApprovers.group.assignment_group_manager);