Email Client Templates Change To Field

brandonwilson
Giga Contributor

I have a client template that I have as my default to the change_request table, so the user can email from the change form. I need it to auto populate the to field with the assigned to and few other fields which reference users. I tried a ${mail_script:script name} but the email.addAddress, one not populating the cc or bcc and to is not an option.

2 REPLIES 2

PeterWiles
Kilo Sage

On the client template, you can just add the filed names. So on the "To" field add "caller_id,assigned_to" etc


Enabling the Email Client - ServiceNow Wiki



Pete


Kiron Valluri
ServiceNow Employee
ServiceNow Employee

I added a Script Include to pull a list of contacts



In the BCC field where I pass the sysid of the business_service



javascript:GenerateMailRecepients.initiallist(current.business_service);



The ScriptInclude pulls email address of user that subscribe to the business service. This logic can be changed as needed



var GenerateMailRecepients = Class.create();




GenerateMailRecepients.initiallist = function(bsID) {


var arr = [];


var gr = new GlideRecord('cmdb_subscriber');


gr.addQuery('item',bsID);


gr.query();


while (gr.next()) {


arr.push(gr.user.email);


}


return arr.toString();


};