Email notification "Event parm 1 contains recipient" not working

DoDo labs___
Mega Sage

Hi!

 

 

If I set a user in the email notification "Users", he receive the email.
However, when I use “Event parm 1 contains recipient,” that user doesn’t.
In the Message HTML, I print the value of parm 1 like this: ${event.parm1}.
The sys_id appears correctly in the email body.
I also tried sending an email address — it also shows up correctly in the body.
But only the user defined in the “Users” field receives the email; the one from parm 1 does not.

Here’s the scheduled script:

 

var userek = new GlideRecord('sys_user');
userek.addQuery('sys_id', '1a88d14a47a4dd90a7a05502e26d4327');
userek.addQuery('active', true);
userek.addQuery('locked_out',false);
userek.addNotNullQuery('ldap_server');
userek.addNotNullQuery('last_login_time');
userek.query();
while (userek.next()) {

gs.eventQueue("FIG_TEST", userek, userek.sys_id, userek.email);
}

1 ACCEPTED SOLUTION

ThoufiqA
Tera Expert

 

Here are the most common culprits for this exact situation. Let's check them one by one.

1. Check the Notification's Table

This is the most likely reason. The notification needs to know what type of record it's dealing with. Since your script is sending a user record to the event, the notification must be set up to listen for user records.

 * What to do:

   * Go to System Notification > Email > Notifications in your ServiceNow instance.

   * Open the notification that isn't working as expected.

   * At the top of the form, look for the Table field.

   * Make sure it is set to User [sys_user]. If it's on "Global" or another table, change it to "User [sys_user]" and save.

2. Make Sure "Send to event creator" is Off

There's a checkbox that can override all your dynamic settings and just send the email to the person who triggered the event (in this case, whoever is running the scheduled script).

 * What to do:

   * On the same notification record, click on the "Who will receive" tab.

   * Look for a checkbox labeled "Send to event creator".

   * Ensure this box is unchecked. If it's checked, ServiceNow ignores your parm1 recipient.

3. Do a Quick Sanity Check on the User's Profile

Sometimes, the simplest things can trip us up. Let's just make sure the user is set up to receive emails correctly.

 * What to do:

   * Find the profile of the user who should be receiving the email but isn't.

   * Verify that their Email field has a valid and correct email address.

   * It's also a good idea to quickly impersonate that user. Once you are acting as them, click the gear icon for settings, go to the Notifications tab, and just confirm they haven't disabled this specific notification.

 

I'd start with 3rd step.

 

Go through these steps, and I'm confident y

ou'll find the issue!

 

Mark this as useful if this helps.

 

Thanks.

View solution in original post

6 REPLIES 6

ThoufiqA
Tera Expert

 

Here are the most common culprits for this exact situation. Let's check them one by one.

1. Check the Notification's Table

This is the most likely reason. The notification needs to know what type of record it's dealing with. Since your script is sending a user record to the event, the notification must be set up to listen for user records.

 * What to do:

   * Go to System Notification > Email > Notifications in your ServiceNow instance.

   * Open the notification that isn't working as expected.

   * At the top of the form, look for the Table field.

   * Make sure it is set to User [sys_user]. If it's on "Global" or another table, change it to "User [sys_user]" and save.

2. Make Sure "Send to event creator" is Off

There's a checkbox that can override all your dynamic settings and just send the email to the person who triggered the event (in this case, whoever is running the scheduled script).

 * What to do:

   * On the same notification record, click on the "Who will receive" tab.

   * Look for a checkbox labeled "Send to event creator".

   * Ensure this box is unchecked. If it's checked, ServiceNow ignores your parm1 recipient.

3. Do a Quick Sanity Check on the User's Profile

Sometimes, the simplest things can trip us up. Let's just make sure the user is set up to receive emails correctly.

 * What to do:

   * Find the profile of the user who should be receiving the email but isn't.

   * Verify that their Email field has a valid and correct email address.

   * It's also a good idea to quickly impersonate that user. Once you are acting as them, click the gear icon for settings, go to the Notifications tab, and just confirm they haven't disabled this specific notification.

 

I'd start with 3rd step.

 

Go through these steps, and I'm confident y

ou'll find the issue!

 

Mark this as useful if this helps.

 

Thanks.

"The 'Allow Notifications' option was turned off."

Glad that this helped you.

 

Kindly mark my answer as helpful so that others can benifit.

 

Thanks

Anand2799
Tera Guru

Hi @DoDo labs___ ,

 

Did you checked on event log record shows correct sys_id and email?

 

On notification record make sure Event parm 1 contains recipient and Event parm 2 contains recipient are checked.

If you are sending it to yourself then also select Send to event creator.