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.

Add "To Address" through email script

n_16
Tera Contributor

Hello,

We have one global notification that will trigger to "requester" when any RITM is created on any catalog item. Here my requirment is, for one "XXX" catalog item if requester select one drop down variable as "ABC", we need to send out an email to one DL along with the requester.

I have created one email script & added in the global notification. But it is not showing in "To" address. However it is showing in CC or BCC

 if (current.cat_item == 'a0b234d9dbf0941027fd10284b961920') {
        var gr = new GlideRecord("sc_req_item");
        gr.addQuery('sys_id', current.sys_id);
        gr.query();
        if (gr.next()) {
            if (gr.variables.request_type == 'create' && gr.variables.data_object == 'GL Master') {
                email.addAddress('To', 'XXX@gmail.com');

                //email.addAddress('CC', 'XXX@gmail.com');

                 //email.addAddress('BCC', 'XXX@gmail.com');
                
        }
    }

How can we add in "TO" Adreess through email script.Please help here.

 

Thanks in advance

7 REPLIES 7

Community Alums
Not applicable

Hi,

Refer to this thread :https://community.servicenow.com/community?id=community_question&sys_id=5a08a0acdbba545011762183ca96...

Mark my answer correct & Helpful, if Applicable.

Thanks,

Sandeep

Gaurav Rotke1
Kilo Guru

Hi n,

Make 'To' to 'TO'. Make O capital.

Mark helpful if it works.

Thank you

Gaurav Rotke

suvro
Mega Sage

You can refer the below thread 

https://community.servicenow.com/community?id=community_question&sys_id=5a08a0acdbba545011762183ca961947