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

Alikutty A
Tera Sage

Hi Nitin,



You should trigger this notification through an event called from a business rule on the requested item table when the item is completed. The event parm 1 should contain the user sys_id which should be current.variables.variable_name where variable_name is the reference field name.



On the notification, you should select this event and also event parm1 contain recipient checkbox. The event should be called from the business rule as



gs.eventQueue('event_name', current, current.variables.variable_name, '');



Events




Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


Also cant you send this notification from the workflow activity?



The notification activity script allows you to push the user as an email recipient.




Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


veena_kvkk88
Mega Guru

Hi Nitin,



You should be able to dot-walk to the Manager field from the reference field. See screenshots below.



Screen Shot 2017-03-16 at 10.32.56 AM.png



Screen Shot 2017-03-16 at 10.33.23 AM.png


Hi veena, thanks for your reply. I agree with your solution, but it works for system reference fields like Requested for, Assigned to etc, But this is a custom field on our form which we created with type 'Reference' I'm trying to pull this field in the Available list


find_real_file.png



How can i populate this ?



Regards!