- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2022 09:01 AM
I have a requirement on changing email recipient dynamically based on location of the incident. The notification will be same.
For example: if location field of incident has value of QQ2323 then email should be sent to vt.2323@xyz.com or if location value is QQ4545 then email should be sent to vt.4545@xyz.com.
Request to kindly help.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2022 09:20 AM
Hello,
You are unable to use mail script to change the "to" recipient, although you can add to the 'cc' of that notification.
If you don't want this email to go to anyone else, but ONE of those email addresses you mentioned above.
Then you'd want to create an onAfter business rule on the table in question, using appropriate conditions for when you want this notification to be sent.
Within the script of that business rule, you can evaluate:
var re = '';
if (current.field_name == 'value') { //if this field on incident is reference, it's a sys_id value not QQ232
re = 'emailaddress1';
} else if (current.field_name == 'value') { //if this field on incident is reference, it's a sys_id value not QQ232
re = 'emailaddress2';
}
if (re != '') {
gs.eventQueue('event_name', current, re, '');
}
So you'd need to create an event in your instance, then place the event name in the above script where applicable. Then change your notification to send when event you create is trigged and in the "who to send to" tab, choose parm1 contains recipients.
This will allow for dynamic recipient on your notification.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2022 08:20 AM
Hello,
Please mark my reply above if it helped guide you Correctly.
I believe I covered that solution that you've mentioned you've implemented above with my response.
Currently, you have your own reply marked as Correct.
Thank you and take care!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!