How to set assignment group to CC through email script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2018 10:20 AM
Hi All,
I want to set assignment group value to email CC, I have tried below script and logs also showing the group name but
email CC value notreflecting the value. please check and help me
event.parm2 ==> INC000001 * Groupname </br> ,
INC000002 * Groupname2</br>,
(function runMailScript(current, template, email, email_action, event)
{
var userGroup = (event.parm2 + '').split('*');
var groupSysID = userGroup[1];
var user1,grup ;
var sgid = groupSysID.indexOf("</br>");
var grpid = groupSysID.substring(0,sgid);
gs.log("test4 :" +grpid);
//add to cc list
email.addAddress("cc",grpid.getDisplayValue()); // any thing wrong for this lines
})(current, template, email, email_action, event);
Thanks in Advance
- Labels:
-
Scripting and Coding
-
Team Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2018 10:29 AM
You need to add the email id while using addAdress.
So if they have a group DL, you should use that
email.addAddress("cc",grpid.email);
Otherwise you will have to loop thru all the members of the group and add their email id to CC
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2018 10:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2020 12:45 AM
Hi There,
I have to implement the same but the group dont have group email.
Thanks,
Snehal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2020 05:06 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 Corrected or Helpful and complete the loop.
Thanks,
Sailesh
try{
email.addAddress("cc", current.assignment_group.email.getDisplayValue(), current.assignment_group.getDisplayValue());
}
catch(err){
gs.log(current.assignment_group.email.getDisplayValue(), current.assignment_group.getDisplayValue()));
}
NOTE: Mark correct or helpful if it helps you.
Warm Regards,
Raj patel