cc people in group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2016 03:47 AM
Hi guys
I have a requirement to send a cc notification to people in a group, the group of people could change depending on what is selected for example assignment group
There is currently two people in this group. If I change the assignment group and use another, they could be 2 different people.
I have done a mail script as follows but doesn't seem to be working. I don't have much experience in scripting or coding and would appreciate any advice or help on were I am going wrong.
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
email.addAddress("cc",current.assignment_group,current.assignment_group.name);
})(current, template, email, email_action, event);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2016 04:33 AM
Hi Wilson,
If you are sending notification from workflow, then in mail script, try some thing below
<mail_script>
email.addAddress("cc", current.variables.variable_name.email, current.variables.assignment_group.getDisplayValue());
</mail_script>
if you are trying to send a notification, when record was created in a table, then you can define a notification on the table and select assignment group in users/groups in fields.
Thanks and regards,
Swamy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2016 04:46 AM
You have to take all members of the group and put this code in loop. If more than one member is there cc will not work this way.
Re: Adding CC in email notification from event parameter
Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2016 09:34 AM
thank you all.
Got it working, it is not coming from a workflow and this is the code that worked
var grp = new GlideRecord("sys_user_grmember");
grp.addQuery("group", current.assignment_group);
grp.query();
while(grp.next()) {
var userid = grp.user;
var user = new GlideRecord("sys_user");
user.addQuery("sys_id",userid);
user.query();
while (user.next()) {
email.addAddress("cc", user.email, user.getDisplayValue());
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-06-2020 05:08 AM
Hi Guys,
This probably might be an old post. I was just checking for the similar one, and couldn't find the relevant code. Below is what I have written and it worked perfectly for me.
var a = new GlideRecord('sys_user_grmember');
a.addQuery('group', current.assignment_group);
a.query();
while (a.next()) {
email.addAddress("cc", a.user.email, a.user.name);
}
If it works for you please mark it as closed and complete the loop.
Thanks,
Sailesh