Remove a recipient from a Email Notification

Community Alums
Not applicable

Can we remove a particular recipient from Email Notification being sent. This Notification is sent to glide field recipients.

Any suggestions will be helpful.   Thanks!!

1 ACCEPTED SOLUTION

Kumar35
Tera Expert

this is what I did recently in a before insert business rule on sys_email -



var usermails = current.recipients.split(",");


var usermails1 = current.recipients.split(",");



for(var i=0;i<usermails.length;i++){


  var gr = new GlideRecord('sys_user');


  gr.addQuery('email',usermails[i]);


  gr.query();


  if(gr.next())


  {


  var cuser = gs.getUser();


    cuser = cuser.getUserByID(gr.user_name);


    if (your conditon to remove the recipient)


  {  


  usermails1.splice(i, 1);


  }


  }


}


current.recipients = usermails1.toString();


View solution in original post

10 REPLIES 10

EthanVanDoorne
Giga Contributor

The condition, then, should be for example,



if (cuser.u_some_flag == true) ?