Email is not being triggered with gs.eventqueue

siddharth26
Tera Guru

Hi All,

am trying to trigger an email using gs.event queue with the below script but its not sending any emails.

 

var userGr = new GlideRecord('sys_user');
userGr.addEncodedQuery('active=true^u_account_typeINemployee,contractor');
userGr.query();

while (userGr.next()) {
gs.info('test1');
if (userGr.u_number) {
gs.info('test2');
var adAccountGr = new GlideRecord('u_ad_user_account');
adAccountGr.addEncodedQuery('u_active=true^u_employeenumberISNOTEMPTY');
 
// Add a query condition to filter 'u_ad_user_account' records based on 'u_employeenumber'
adAccountGr.addQuery('u_employeenumber', userGr.u_number);
adAccountGr.query();
 
// Check the number of matching 'u_ad_user_account' records
var adAccountCount = adAccountGr.getRowCount();
gs.info('Number of u_ad_user_account records found: ' + adAccountCount);
 
while (adAccountGr.next()) {
gs.info('u_employeenumber: ' + adAccountGr.u_employeenumber);
//gs.eventQueue('comparemail', adAccountGr);
gs.eventQueue('email.match',adAccountGr);
gs.info('email sent');
}
}
}
could you suggest why its not sending an email
 
thanks
 
10 REPLIES 10

Hi @siddharth26,

  1. Check System Policy > Events > Event log (Here you can see if your event is running and sending the parameters correctly).

  2. If you find it in that list and everything is ok this means that the configuration on the notification is the problem, if not, the problem would be with the events, possibly with its parameters.

Hi Tod1,

i have checked the event and event log i can see the event name which i have created email.match 

and notification also i have created and whom to send also i have kept a active user account .

 

below is the notification 

siddharth26_0-1695729890539.png

thanks

 

 

Anand Kumar P
Giga Patron
Giga Patron

Hi @siddharth26 ,

You haven't specified the user to whom you are sending the email using the gs.eventQueue('email.match', adAccountGr) function. If you have not configured a recipient user in the email notification who will receive tab, make sure to pass that user's information as a parameter, such as gs.eventQueue('email.match', adAccountGr,adAccountGr.username(field in u_ad_user_account table).

 

Thanks,

Anand

Hi Anand , 

 

Thank you for the response .

I have given the recipient name in the notification and given this event registry name in the notification as well. 

 

siddharth26_0-1695726830685.png

thanks

Sandeep Rajput
Tera Patron
Tera Patron

@siddharth26 Can you check if your Notification is configured to trigger on event "email.match". Ideally, your notification should look like the following.

Screenshot 2023-09-26 at 5.19.12 PM.png

Here event name dropdown should have your 'email,match' event populated.