Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

how to add group recipients to bcc

radhaidiotic
Kilo Contributor
Element

u_grp_rec_13

Reference

sys_user_group

15 REPLIES 15

Mihir Mohanta
Kilo Sage

Hi Radha,



You need to write a mail script to add BCC in notification.


Inside mail script query to "sys_user_grmember" table and get user list.


Pass the emails of the user list to by using below format


email.addAddress("bcc", "john.secret@example.com","John Roberts");



Please mark it as Helpful/Correct according to its impact.



Thanks,


Mihir


Deepa Srivastav
Kilo Sage

Use below code for getting grp members:-



Kindly mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy.



var gp = ' ';


 
  var grp = new GlideRecord('sys_user_grmember');
  grp.addQuery('group',current.u_grp_rec_13);
  grp.query();
  if(grp.next()) {
    if (gp.length > 0) {
      //build a comma separated string of groups if there is more than one
      gp += (',' + grp.user);
    }
    else {
      gp = grp.user;
    }
  }


its not working where you adding group recipients to bcc


Hi Radha,



Have you followed the steps I have written in my previous comment?



Thanks,


Mihir