The CreatorCon Call for Content is officially open! Get started here.

How to add reference field/value in 'Who will receive' tab in email notification

Nitin_NOW
Tera Guru

Hello Team

I have an issue related to email notification. We have a reference field in one of our catalog item. I'm trying to add this field in the 'Who will receive' tab in the notification,

find_real_file.png

but couldn't find the way. The point here is, upon resolution of the RITM, this notification should be triggered to the user's ( who is in the reference field ) manager.

find_real_file.png

Any idea on how to add this users ( scott hatch ) manager to be added in the 'users/group in field' list ?

Regards!

1 ACCEPTED SOLUTION

Hi Nitin,



If you noticed, I have declared a variable named 'recipient' in my last response. I'm passing that variable inside gs.eventQueue() function. The syntax of object.eventQueue() can be understood from the section 3.1 of this link GlideSystem - ServiceNow Wiki . If you are trying to send the email to the person who is selected in the reference field in the variable then you must define the variable as var recipient = current.variables.variable_name; If you are trying to send the email to the manager of the selected person then it would be like var recipient = current.variables.variable_name.manager; Reference field always passes the sys_id of any user, so you do not have to write recipient.name.


For your 2nd question, the answer will be YES. But you must remember the logic of call the same event must be different and same a single notification should be defined. Otherwise, whenever you are calling the same event from multiple business rules for multiple logic, the same notification will get triggered (considering the notification is selected as Event is fired with the same event).


Please try again now and let me know if you face any problem.



I hope this helps.Please mark correct/helpful based on impact


View solution in original post

11 REPLIES 11

I'm having a similar issue. Could you help me out?


Send email notification to owner of CI


saikiranyadav1
Tera Contributor

Hello @Nitin_NOW According to your Question I Understood that Sometimes we could not able to find a way to dot walk to some of the Fields in the [who will receive tab] but there is a simpler way where you can acheive your requirement.
So By using background Script and Gliding to [sysevent_email_action] with the [Current Notification Sys_id] Try to Change the Required Fields you want and use current.update() and run the BG.And Once the BG has been Run then Try Refreshing the Notification you will find your requirement to be completed.
For your Reference im adding the Background Script Please Review it :

var current = new GlideRecord("sysevent_email_action");
if (current.get("Sys id of the Notification")){
current.recipient_fields = 'company.ref_customer_account.u_service_coordinator_group'; 
current.update()
gs.info(current.recipient_fields);
}