Send email notification to different users based on a particular condition?

Supratik3
Tera Expert

Hi All,

I have a requirement where I need to trigger a single record created notification(i.e. for a record created through record producer via portal) to different users, depending on what the current instance is, i.e. DEV, UAT or PROD.

For example, if the record is created in DEV instance, send to user A; if the instance is UAT, send notification to user B; if instance is Production, send to User C. 

Thanks in advance!

 

 

4 REPLIES 4

Martin Ivanov
Giga Sage
Giga Sage

Hello. Please go through this thread.

In short, you must create a notification email script, where you will check the instance name (here it is described how to get the name). Then based on the result, set different values of the recipient.

Please Mark Correct and Helpful if my answer helps you resolve your issue. Thanks!
Martin Ivanov
Community Rising Star 2022


Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Martin Ivanov
ServiceNow MVP 2023, 2024

Supratik3
Tera Expert

Hi Martin,

 

Thanks for the prompt reply.

I have created a notification email script wherein I have checked the instance as per below :

   var instance = gs.getProperty("instance_name");
 
    if(instance == "demoDEV") // DEV

However I need a bit of help as to how to assign recipient as per instance, as per eventQueue function. Could you please help guide how to proceed? Many thanks.

Philippe Casidy
Tera Guru

Hello!

Notifications in sysevent_email_action?

You can create one notification per instance and use the Advanced Condition field in sysevent_email_action to trigger according to gs.getProperty("instance_name");

 

Philippe

Martin Ivanov
Giga Sage
Giga Sage

Hi. If my answer has helped you resolve your issue, Please mark Correct and Helpful. This way, other users may also benefit from the thread. Thanks!
Martin Ivanov
Community Rising Star 2022


Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Martin Ivanov
ServiceNow MVP 2023, 2024