Approve button not showing in email notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2023 07:20 AM
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,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2023 06:38 AM
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
Shravan
Please mark this as helpful and correct answer, if this helps you