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

how to create a button in an email

JA8
Kilo Contributor

suggest me  step by step of how to create a approve button in an email.

thanks in advance

4 REPLIES 4

Shashikant Yada
Tera Guru

Hi,

Store the Approve and Reject images in the Images Module.

Create one Notification email script and add below code:

var img = "/approve.png"; //Path of image

var response = "approve";

var emailbod = "I approve this request.";

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

Add the above email script under Approval Notification:

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

Hope this will help you

Hello Shashikant 

Im having some issues displaying the body in the approval reply, my mail script matches yours. Would there by anything else preventing it?

 

The URL is:

mailto:XXXXXXXXXXX@service-now.com?subject=%20Re:RITM0034100%20-%20approve&body=%0A%0ARef:MSG0390932

 

Many thanks

Steve

Ugggg, dont mind me...I found the script include

...not enough coffee today

Ruhi Jibhyenka1
Mega Guru

Hi sudha,

Try this,

Below are portions of a script include I wrote that was called from mail scripts to print the html. I found this approach easier to manage and re-use. You can essentially drop these in a script include and call them from a mail script via a call like

 

template.print(new myUtil().getButton('https://' + gs.getProperty('instance_name') + '.service-now.com/nav_to.do?uri='+tbl+'.do?sys_id='+GlideRec.getValue('sys_id')+'', btnName, 'View the record' ));

 

 

//specify the link (ie https://mylink.com), the text (Button Text), and the tool tip or title text

 

getButton:function(link,text,title){

 

return '<table width="100%" border="0" cellspacing="0" cellpadding="0">'+

 

'<tr><td><table border="0" cellspacing="0" cellpadding="0"><tr>'+

 

'<td align="center" style="-webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px;" bgcolor="#37424A">'+

 

'<a title="'+title+'" href="'+link+'" target="_blank" '+

 

'style="font-size: 16px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; text-decoration: none; '+

 

'-webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; padding: 12px 18px; border: 1px solid #222222; display: '+

 

'inline-block;"><strong style="font-weight:normal;">'+text+'</strong></a></td>'+

 

'</tr></table></td></tr></table>';

 

},

 

 

Button this code generates:

 

find_real_file.png

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy.
Thanks,
Ruhi.