The CreatorCon Call for Content is officially open! Get started here.

Need to put user in cc for approval email

Krishna16
Kilo Contributor

Hi All,

 

There is a notification on the approval table which gets triggered every time a record is inserted into the approval table, however, we have a requirement that we need to cc a user XYZ in all the approval notifications. Please suggest.

2 REPLIES 2

Aman Kumar S
Kilo Patron

Write a email notification script and embed that in your approval notification using:

email.addAddress("cc","emailaddress","Name of user");

Best Regards
Aman Kumar

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Are you willing to update the OOB Notification on sysapproval_approver table?

If yes then you will have to use email script and ensure the CC user is being set only for your catalog item approval and not for every item

Create email script and include it in your email notification body

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {

          // Add your code here
	
	var gr = new GlideRecord("sc_req_item");
	gr.addQuery("cat_item.name", "Your Item Name here"); // give your item name
	gr.addQuery("sys_id", current.sysapproval);
	gr.query();
	if (gr.next()) {
		email.addAddress("cc","xyz@test.com","XYZ"); // give correct email address and correct display name of user  
	}	

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

find_real_file.png

 

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader