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

Greg42
Mega Guru

Hi Shaik,



You can have a look of how it's done in one of the out of the box notifications:



https://your_instance.service-now.com/nav_to.do?uri=sys_script_email.do?sys_id=f25bc270d711120035ae2...




Regards



Greg


Greg thanks for the reply.



I already gone through the OOB Take me to the incident example, problem i am getting my link which redirects through inbound email action whenever user clicks the link from email body incident gets reopen now idk how to change it as button since i am trying with the same example of take to my incident it is redircting to the incident but its not reopening the incident


Here is the code which i copied & updated from OOB take to the incident:



(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,


                  /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,


                  /* Optional GlideRecord */ event) {




                  // Add your code here


var link = current.getLink();


var links =   ('<a href="mailto:dev29848@service-now.com' +   '?subject=Re: please reopen the incident'+current.number+'   &body= hello '     + '">'+ ' </a>');


template.print('<font face="helvetica">');



var backgroundColor = 'background-color: #278efc;';


var border = 'border: 1px solid #0368d4;';


var color = 'color: #ffffff;';


var fontSize = 'font-size: 16px;';


var fontFamily = 'font-family: Helvetica, Arial, sans-serif;';


var textDecoration = 'text-decoration: none; border-radius: 3px;';


var webKitBorder = '-webkit-border-radius: 3px;';


var mozBorder = '-moz-border-radius: 3px;';


var display = 'display: inline-block;';


var padding = 'padding: 5px;';



// if (email_action.name == "Incident Survey") {


// color = 'color: #343d47;';


// backgroundColor = 'background-color: #e6e8ea;';


// border = 'border: 1px solid #bdc0c4;';


// }


template.print('<a href="' + links + '"');


//template.print('<a href="mailto:dev29848@service-now.com' +   '?subject=Re: please reopen the incident'+current.number+'   &body= hello '   + email.watermark + '">'+ ' </a>');


template.print('style="' + backgroundColor + border + color + fontSize + fontFamily + textDecoration + webKitBorder + mozBorder + display + padding);


template.print('">');


template.print(gs.getMessage('Take me to the Incident'));


template.print('</a>');


template.print('</font>');


template.print('<br><br>');


template.print('<p><font size="3" color="#808080" face="helvetica">');


template.print('Thank you.');


template.print('</font></p>');




})(current, template, email, email_action, event);


Hi Shaik,



Have you checked what information you getting in your inbound action?



Also look at these two lines:



var links =   ('<a href="mailto:dev29848@service-now.com' +   '?subject=Re: please reopen the incident'+current.number+'   &body= hello '     + '">'+ ' </a>');


template.print('<a href="' + links + '"');



You're printing href in href that most likely messes up things as well.




Regards



Greg