Group Email

Tarasingh26
Tera Expert

Hi All,

 

I have requirement to send email notification to servicenow group members. That group does not have group email. 

I need to keep that group in CC. how this can be achieved. Please share the solution if someone has implemented same kind of scenario.

 

Thanks,

Tara Singh

7 REPLIES 7

Mark Manders
Mega Patron

If there is no group email, the email will be send to all members separately, so you don't need to do anything for that. If it would have a group email and you also wanted to email the separate group members, you would need to tick the 'include members' checkbox. 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Thanks for you reply. But how can I put group in CC if it does not have group email id? Ideally the syntax is 

email.addAddress("cc", "Group Email ID", "GroupName") but in my case there is no Group Email ID.

Vrushali  Kolte
Mega Sage

Hello @Tarasingh26 ,

 

You can write below script in the email notification script to get the user's email ID -

 

 

 var member = new GlideRecord("sys_user_grmember");    
member.addQuery("group","c38f00f4530360100999ddeeff7b1298"); //Replce group sys_id
    member.query();

    var list = [];
    while (member.next()) {
        list.push(member.user.email);
    }
   gs.info("Email " + list.toString());
// List contains comma seperated email address of group member.
email.addAddress('cc', list);

 

 

 

If my answer solves your issue, please mark it as Accepted ✔️and Helpful👍!

Hi, Thanks for your reply.

Code is working fine to print email addresses.  Email address value is coming but seems like this line is not working to set email addresses dynamically, as copied field is blank in email logs.

email.addAddress('cc', list);