how to use email.setFrom in Scheduled Reports

sohan_snow
Tera Contributor

Hi All,

I am scheduling a report and would like the recipients to receive it from Global Change Management instead of the regular IT Service Desk<instance name@service-now.com>.

How can this be achieved

Thanks in advance

1 ACCEPTED SOLUTION

brendanwilson84
Kilo Guru

Mail script as follows


Name -Sendfrom



(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,


/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,


/* Optional GlideRecord */ event) {



// Add your code here


//var from = current.u_from;


email.setFrom('Global Change Management');


})(current, template, email, email_action, event);



In your report body place the following


${mail_script:Sendfrom}


View solution in original post

4 REPLIES 4

sudharsanv36
Kilo Guru

Hi,



From the mesage section, I believe we can call the mail scripts. Please refer below.



Scripting for Email Notifications - ServiceNow Wiki


johnram
ServiceNow Employee
ServiceNow Employee

The ServiceNow Wiki content is no longer supported. Updated information about this topic is located here: Scripting for Email Notifications




Visit http://docs.servicenow.com for the latest product documentation


gauravchoudhury
Tera Guru

Hi Sohan,



Please refer to the below links for your reference:



brendanwilson84
Kilo Guru

Mail script as follows


Name -Sendfrom



(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,


/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,


/* Optional GlideRecord */ event) {



// Add your code here


//var from = current.u_from;


email.setFrom('Global Change Management');


})(current, template, email, email_action, event);



In your report body place the following


${mail_script:Sendfrom}