Event registry

Rosy14
Tera Guru

HI

I want to send notification to all the users added in u_select_buying_agent_user field(List type). and address them individually like Hi A, Hi B etc. it is on Buying event form.

Rosy14_0-1702028544676.png

Rosy14_1-1702028566766.png

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here
    var getListusers = current.u_select_buying_agent_user;
    var splitusers = getListusers.split(',');
    for(var i=0;i<splitusers.length;i++){
        gs.eventQueue('sn_customerservice.sendEmail',current,splitusers[i]);
    }

})(current, previous);
Email Script:
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {

          // Add your code here
    var gr = new GlideRecord('customer_contact');
    gr.get(event.parm1);
    template.print(gr.first_name + " "+gr.last_name);

})(current, template, email, email_action, event);
 
Rosy14_2-1702028687097.png
Rosy14_3-1702028700275.png

 

recipients and addressing is not working.

please help

 

2 REPLIES 2

piyushsain
Tera Guru
Tera Guru

Hi,

It might be that the email notification is not able to take up the email of the user from the parameter.

try sending the email id of the user in param1 and in param2 the full name of the user in the BR itself and use them directly in email , no need to use email script

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,
Piyush Sain

can you explain how to write