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

Approve button not showing in email notification

reddy8055
Tera Contributor

Hi,

We have created below email script to pull approve button from db_image table but approve button is not showing in email notification. Checked png image is stored in db_image table, tried updating manually as well didn't worked.

 

var img = "/ApproveButton.png";
//template.print('<img src="' + img + '"/>');

var response = "approve";

var emailbod = "I approve this request.";

template.print(renderMailtoButton(img, response, emailbod));

 

Thanks,

1 REPLY 1

Sai Shravan
Mega Sage

Hi @reddy8055 ,

Can you please try as below

 

Create mail scripts as below for Approve option

 Approve: email.button.approve.insert

var img = "/Approve.png";

var response = "approve";

var emailbod = "I approve this request.";

template.print(renderMailtoButton(img, response, emailbod));

Script include: renderMailtoButton

function renderMailtoButton(image, response, emailbod){
	
	var instance = gs.getProperty("instance_name");
	var link = "https://" + instance + ".service-now.com";
	var mark = email.watermark;
	var number = current.number;
	var emailAddress = instance + "@service-now.com";
	if (current.getTableName().indexOf("sysapproval") != -1){
		number = current.sysapproval.number;
		}
			var mailLink = '<a href="mailto:'+ emailAddress + '?subject=Re:' + number + ' ' + response +'&body=' +  emailbod +  mark + '"><img src="' + link + image + '"></a>';
	return mailLink;
	
}

 

Call the mail scripts in the notification body (What it will contain) so as to make it work in the format as below.

Dear ${approver.name},

Please approve by clicking the button below and sending the email opened after click of below button.

${mail_script:email.button.approve.insert}

 

Regards,

Shravan

Please mark this as helpful and correct answer, if this helps you

Regards,
Shravan
Please mark this as helpful and correct answer, if this helps you