Email filter - action script generate two duplicate emails

Yuanquan Fu
Tera Contributor

Hi Expert,

 

I defined an email filter to send a bounce-back notification email to incoming email sender which is outside our domain, and move the email to junk folder.

YuanquanFu_1-1692794061269.png

 

But in the action script, no matter I tried to trigger an event

gs.eventQueue("Notification on Rejection", current, current.user, current.subject);

 

or create a new record in the sys_email table:

 

var notify_record = new GlideRecord('sys_email');
notify_record.type = 'send-ready';
notify_record.recipients = current.user;
notify_record.subject = 'The subject of the email goes here.';
notify_record.body = 'HTML content goes here';
notify_record.insert();

 

The system will always send 2 duplicate emails to email senders outside our domain:

YuanquanFu_2-1692794323320.png

 

Can anyone provide some help?

 

Thanks in advance,

Yuanquan

 

4 REPLIES 4

Yuanquan Fu
Tera Contributor

From the log table, I can see that the email filter was executed twice.

YuanquanFu_0-1692798597426.png

 

Laszlo Balla
Mega Sage
Mega Sage

Try adding the initialize method right after you instantiated your GlideRecord, i.e.:

notify_record.initialize();

Yuanquan Fu
Tera Contributor

Thanks Laszlo. I tried to add the initialize method but the issue still exists.

Perhaps some of the steps described in this knowledge article can help:

Troubleshooting duplicate emails generated by the instance