How to create a button in email
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2017 03:09 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2017 04:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2017 06:01 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2017 01:37 PM
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: