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

ya i followed as


var user = new GlideRecord("sys_user_grmember");


    user.addQuery("sys_id", recipients);


  user.addQuery("sys_id", grecipients);


    user.addQuery("notification", 2); //email


    user.addQuery("email", "!=", "");


    user.query();



    while (user.next()) {


          //add to bcc list


      var bcc = current.u_bcc ;


          email.addAddress("bcc", user.email, user.getDisplayValue());


      email.addAddress("bcc",addditionContact, "");


    }


Code is wrong Radha...


Mihir Mohantacode is correct


your code is not working


Write the email script like:(Modify the script according to your need)



var grp= new GlideRecord("sys_user_grmember");


grp.addQuery("group", "sys_id of the group you want to add as BCC");//sys_id of the group you want to add as BCC


grp.query();


while(grp.next()){


  email.addAddress("bcc", grp.user.email, grp.user.name);


}



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



Thanks,


Mihir