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

How to create a button in email

shaik_irfan
Tera Guru

How to create a button in email,

I am able to create a link but can anyone please let me know how to create a button instead of link

7 REPLIES 7

Still it is taking as link:



find_real_file.png



INC0010380 which is a link when i click on that link it reopens the incident, i want that to be visible as Button


You will have a link but your html will be messed up. No surprise you see html here. Log your final html, paste it to an editor and see where the issue is.



You will most likely had something like that: <a href=<a href='something'>Text</a> ...


You need to fix that for the css to applied correctly.




Regards



Greg


TylerTeter
Kilo Guru

Looks like you're pretty far along on this already, but wanted to share the approach I took, since I also wanted buttons, but found how to make better buttons than the ServiceNow template ones. I'd really recommend this site, which is where I sourced some of this code. The Ultimate Guide to Bulletproof Buttons in Email Design



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