- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2014 02:34 AM
Hi All,
I am using email methode ' addAddress(String type, String address, String displayname) - type can be "cc" or "bcc" '
in my email script with the help of this methode I am able to send "CC" OR "BCC" but
I want to set "TO" address dynamically with the help of e-mail script.
Please let me know it's posible in ServiceNow.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2014 11:42 PM
If this notification is being triggered by an event, it sounds like you will have to use another form of script to set a list of additional users of who you want to add to the "To:" list and pass them into the notification under Event Parm 1 and/or Event Parm 2.
Wiki URL Link:
Email Notifications - ServiceNow Wiki
Event parm 1 contains recipient | (Visibile from the Advanced view) Select this check box (true) if the event parameter 1 contains the email recipient. This field is only visible when the Send when field has the value Event is fired. |
Event parm 2 contains recipient | (Visibile from the Advanced view) Select this check box (true) if the event parameter 2 contains the email recipient. This field is only visible when the Send when field has the value Event is fired. |
Example:
gs.eventQueue("change.inserted", current, gs.getUserID(), gs.getUserName());
In the above example, the sys_id returned from "gs.getUserID()" is being passed as Parm1 and the "user_name" is passed as Parm2.
You could use the "eventQueue" function to pass another sys_id or email address.
Let me know if this helps and if this answers your question, please make sure to mark your question answered if so.
Kind Regards,
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2014 03:04 AM
Hello Sanjeev,
Use the following code,
email.setReplyTo("abc@yourcompany.com");
Wiki Link : https://wiki.servicenow.com/index.php?title=Scripting_for_Email_Notifications#Adding_CC_and_BCC_Reci...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2014 04:50 AM
Hi Chennaiman,
Your answer is not correct I am not asking about "RepltTo". I am asking about "To:".
So is there any way we set To: at run time.
just like "CC"
e. g. addAddress('cc', 'example123@abc.com');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2014 06:24 PM
Hi Sanjeev,
Can you give more details as to what you are trying to solve? Since you are able to supply the "To:" in a number of ways with email notifications, I'm not sure I entirely follow what you are trying to achieve by setting "To:" in a script at run time.
Perhaps with more detail, I may be able to help work out a solution.
Kind Regards,
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2014 11:17 PM
Hi Mike,
When we create some Email Notification in service now we have a sction "who will receive" In this section we select some Users/Group or users Or Groups or both. and also select some template under section "What it will contain".
Now when system send e-mail to User or Group in email recipeant (To:) will contain User e-mail address.
As shown in above Image.
We are able to set "Cc" with the help of "addAddress" function .
I want to set To: or recipent e-mail address with the help of email script.
I don't want to put any thing under "Who will receive" section.
If you have some solution let me know.
Thanks,
Sanjeev Kumar
NCR Corporation.