Add User in CC of an email
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
I have a requirement in my current project where I need to create an email script in ServiceNow. In the User table, I have three custom fields: L1 Approval, L2 Approval, and HR Employee. I need to include the users from these fields in the CC section of a notification. Could you please provide the email script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
what is the table of your notification. L1, L2 and FR will be based on some user for example requested for.
var ccEmails = current.requested_for.L1_approval +"," + current.requested_for.L2_approval + ","+ current.requested_for.hr_employee.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
57m ago
and in CC we need to add L1 ,L2 and HR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
@may13 , This is very simple.
Create a new mail script with any name.
Add a script in the mail script
email.addAddress("cc", current.requester.manager.email, current.requester.manager.name);Replace current.requester.manager.email with your fields name like - current.approval1, current.approval2.
Call the Script in Your Notification:
- Go to the notification (e.g., Incident [sys_notification]) you want to modify.
- In the What it will contain tab, find the Message HTML (or Plain Text) field.
- Add your email script as ${mail_script:your_email_script_name}
Follow this for more information - How to add CC in an email notification
If my response has helped you, kindly mark it as helpful and accept the solution.
Regards,
Nayan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
44m ago
Hello @may13 ,
Use this script according to your requirement,
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
email.addAddress('cc', L1_approval.email, 'L1_approval.name');
email.addAddress('cc', L2_approval.email, 'L2_approval.'name);
email.addAddress('cc', hr_employee.email, 'hr_employee.name');
})(current, template, email, email_action, event);
If my response helped mark as helpful and accept the solution..
