Notification assigned to/group recipients based on the script condition

Harihara Sudha1
Kilo Expert

Hi Team,

I have a requirement for a script to send a email notification IF assigned to is not empty THEN send to Assigned to ELSE send to Assignment Group. Please note, this can be provided in condition but our management need to reduce the email notification count. So in a single notification we have been requested to check other conditions like state, priority etc.. and also in the notification recipient it should go to assignment group if assigned to is empty else it should go to assigned to if assignment group is empty.

Please provide a script/work around.

5 REPLIES 5

HarshTimes
Tera Guru

Hi Hari


We had the same requirement. We setup the conditions on the email notification for this. If you have some other conditions then you can trigger an event based on your condition and setup a notification based on this event.


Chuck Tomasi
Tera Patron

My approach would be to do this with two notifications that each call one template.



Conditions on notification 1 include a check to see if the assigned to is empty and use the assignment group as a recipient.



Conditions on notification 2 include a check to see if the assigned to is NOT empty and send to the assigned to as the recipient.



The subject and body of the message can be standardized in a notification template and referenced from both.



Email Notifications - ServiceNow Wiki


sangeetsnc
Kilo Contributor

Hi Hari,



Solution would be to create event based notification and use <mail_script> (If you want different field for different receiver) with the notification to achieve this. Based on the condition you can call gs.eventQueue() from server side script (ex: BR , SI etc) and send recipient as event parameter .   If this fits your requirement and if you need more specific details , do not hesitate to contact.



Regards,


Sangeet


Hi Sangeeth,

 

I have a same requirement and dont want to proceed with 2 notification with condition ( assigned to is empty or not).

It will be more helpfull if you can  give me one example to implement with gs.eventQueue().

I am new to servicenow and no idea of event queue