- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2022 06:49 AM
Hello!
I have a catalog item using the Flow Designer. The requirement is to send an email to a reference variable pointing to the User table. I am using a 'Send Notification' action.
I've done a bit of googling but what I can find are solutions using the Workflow editor or a Business Rule. Is this possible using an email script? I've tried the below but it does not work.
var email1 = current.variables.user_reference1.email.toString();
var email2 = current.variables.user_reference2.email.toString();
email.setReplyTo(email1, email2);
Please help!
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2022 02:30 AM
So before using the events we need to make sure that the event is registered in event registory table.
Once the event is registered you need to write code in your server side scripts to trigger that event by using below method:
gs.eventQueue('name of the event','current object which is used for triggering the event','Parameter 1','parameter 2');
You can read more about the event queue method in below thread:
Once the event is generated you need to go to your table for which you are triggering the notifications. And you need to create a notification there. In 'when to sent' section you need to select 'Event is fired'. And in your 'who will receive' section you can set the event parameters in advanced view.
Below links should help you understanding more about the above two sections:
When to Send | ServiceNow Developer
Who Will Receive | ServiceNow Developer
Hope this will help you understand the concepts of events more and how to use them in notifications.
Please mark this as correct and helpful if it resolved the query or lead you in right direction.
Thanks,
Mohit Kaushik
Community Rising Star 2022
Mohit Kaushik
ServiceNow MVP (2023-2025)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2022 07:06 AM
Hi There,
You cannot send email to 'TO' using email scripts. It can be used to send 'CC' or 'BCC' by using the below methods.
email.addAddress('cc',current.variables.user_reference1_email.toString());
email.addAddress('bcc',current.variables.user_reference1_email.toString());
You can know more about the email scripts in below link.
However you can use Events to trigger email notifications and send it 'TO' as well by using event parameters.
Please mark this as correct and helpful if it resolved the query or lead you in right direction.
Thanks,
Mohit Kaushik
Community Rising Star 2022
Mohit Kaushik
ServiceNow MVP (2023-2025)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2022 11:17 PM
Mohit, I am interested in using Events. How do I add the variable email strings using event parameters? I've researched how to create an Event in flow designer but could not find what steps are needed after.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2022 02:30 AM
So before using the events we need to make sure that the event is registered in event registory table.
Once the event is registered you need to write code in your server side scripts to trigger that event by using below method:
gs.eventQueue('name of the event','current object which is used for triggering the event','Parameter 1','parameter 2');
You can read more about the event queue method in below thread:
Once the event is generated you need to go to your table for which you are triggering the notifications. And you need to create a notification there. In 'when to sent' section you need to select 'Event is fired'. And in your 'who will receive' section you can set the event parameters in advanced view.
Below links should help you understanding more about the above two sections:
When to Send | ServiceNow Developer
Who Will Receive | ServiceNow Developer
Hope this will help you understand the concepts of events more and how to use them in notifications.
Please mark this as correct and helpful if it resolved the query or lead you in right direction.
Thanks,
Mohit Kaushik
Community Rising Star 2022
Mohit Kaushik
ServiceNow MVP (2023-2025)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2022 07:42 AM
Hi
Did you get a chance to look into my suggestion, If your query is resolved then please mark the answer as answered so that it can go from unanswered thread and others can also get benefited from the same.
Thanks,
Mohit Kaushik
Community Rising Star 2022
Mohit Kaushik
ServiceNow MVP (2023-2025)