CC in email sript

raveena2
Kilo Expert

I want to add a cc in email scripts.For this purpose i have written a email notification script as

var gr = new GlideRecord("incident");

gr.addQuery("sys_id",current.sys_id);

gr.query();

if(gr.next())

{

  email.addAddress("cc",String(gr.caller), String(gr.caller.getDisplayValue()));

}

I am getting a cc field in my mail but getting the value stored database for the caller filed(it is a reference field).

find_real_file.png

How to get the name of the caller in the cc field?

Thanks in advance !!!

1 ACCEPTED SOLUTION

ghsrikanth
Tera Guru

You have to do dot-walking as it is the reference field and in the cc field you should be put the email of the user -



var gr = new GlideRecord("incident");


gr.addQuery("sys_id",current.sys_id);


gr.query();


if(gr.next())


{


  email.addAddress("cc",gr.caller.email.toString(), gr.caller.name.toString());


}



Mark if it is helpful or correct, feedback is appreciated


View solution in original post

8 REPLIES 8

Hi Paradise,


If your email notification is on Requested item table , you could simply access the variables using           current.variables.variable_name


If its on some other table then first get the GlideRecord object(say grRitm) of that requested item and then use       grRitm.variables.variable_name


ghsrikanth
Tera Guru

Hi Raveena,



Is the issue is resolved? If resolved, could you please mark the answer as correct, as it will help the community



Thanks,


Thanks Srikanth .I have marked it as correct answe 🙂



Regards,


Raveena Bhatia


Its great to know that the issue is resolved. Thanks for your feedback