Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

To and Cc in Notifications

harinya
Tera Contributor

HI ,

I need to send a notification to users listed in the users field on the Assessment Persona table (sn_smart_instance_persona).
The trigger condition is when the state changes to "Cancelled" on the Assessment Instance table (sn_smart_asmt_instance).

Tried like below

  • Created a notification on the sn_smart_asmt_instance table with the correct trigger condition.

  • Attempted to send the email using an email script with email.addAddress('to', ...) to target users from the Persona table, but it is not working.

  • I also need to include users from the additional_users field (a Glide List on the same Assessment Instance record) in the CC.
    Thanks in Advance

7 REPLIES 7

@harinya 

you can use after update business rule and use gs.eventQueue() and mention the recipient

I hope you are aware on how to do that.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Shruti
Mega Sage
Mega Sage

Hi,

 

1. Create an event (System policy -> Events -> Registry)

2. Create a business rule trigger condition is when the state changes to "Cancelled" on the Assessment Instance table (sn_smart_asmt_instance) and use gs.eventQueue('event.name', GlideRecord, parm1, parm2); to generate the event. Pass the "Recipient"/"To Address" as parm1.

3. Create a notification 

Send when - event is fired

Event name - select the event created in step 1

Shruti_0-1750825263349.png

 

4. Create a notification email script to include users in CC

Chaitanya ILCR
Mega Patron

Hi @harinya ,

try using addRecipient method for setting to address(tested global application and is working looks like it doesn't work in the scoped application) 

 

try this with global notification email scripts to set (TO address)

 

email.addRecipient('youremail@domain.com'); 
 
 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya