- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2016 12:29 PM
Hi All,
Please help I am looking to add a cc box in an email notification but I can't seem to locate how to do this. I see a bunch of things in the community but it appears that it all involves scripting. Is there anyway around this?
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2016 06:52 PM
That is definitely doable, too. So, rather than putting in an address and name manually, you can reference a field/variable from the table.
So, you could do something like this to send a CC to the manager of the current assignment group on an incident email:
email.addAddress("cc", current.assignment_group.manager.email, current.assignment_group.manager.name);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2016 12:38 PM
CC and BCC on notifications will, unfortunately, require mail scripts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2016 12:52 PM
Hi Robert,
Are you able to help me out with this? I am new to scripting and I don't understand where these scripts need to be placed in the notifications.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2016 01:14 PM
Fortunately, the scripting for adding CC/BCC recipients isn't too scary, depending on what you need to do.
In a basic sense, you need to go into the notification you want to add CC's to and find the link for "Show Notification Scripts". Give that a click.
In the list view, hit "New", then give your script a name. I tend to name in a easy to reference method, while avoiding white-spaces. For example, if I'm going to add a CC list script for closed incidents, I'd call it something like "incident_closed_cc_list" (minus the quotes).
In the script field, you'll need to put in this code to add a CC recipient:
email.addAddress("cc", "john.copy@example.com","John Roberts");
The syntax of the function is email.addAddress("string type", "string address", "string displayname", where the type can be CC or BCC.
Once you have the email client script finished (you can add as many of these lines as needed, and with JS wizardy, much magic is possible), save the record.
Now, go back to your notification and call the email client script in the body of the email like this:
${mail_script:whateveryounamedyourmailscrptgoeshere}
Or, if we use the dummy script I made up, it would look like this:
${mail_script:incident_closed_cc_list}
Here's the link for the SNow wiki on email scripting if you've not had a chance to read it yet: Scripting for Email Notifications - ServiceNow Wiki
Hope this helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2016 06:30 PM
Thank you SOO Much for breaking it down for me! I have another question for you. What if I need the script to fill in the "CC" field automatically with an customize reference field on a request item. For example the "CC" field will pull from an field called "Alternate Contact" that references the sys user.