The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Email Approval Links with an Image

Makosko
Tera Expert

Hello Gurus,

I am looking to replace standard email link text ( e.g.: click here to approve RITM00033 ) with an image ( something like thumbs up for approve and thumbs down for reject ).

I`ve modified the original mailto.approval email template so that it includes an image tag as follows: <img src="/thumbs_up.pngx" width="100" height="100" />

The problem is that SN escapes HTML tags, essentially turning my image into a text.

Is there any way to tell SN not to escape HTML ?

Thanks a lot ! ( Please see attachments for more info)

20 REPLIES 20

No . It lloks like below.



${mail_script:incident_script_1}




login below link and see my code


https://demo014.service-now.com/login.do




username & pwd : admin




After login click below link to access the notification




https://demo014.service-now.com/sysevent_email_action.do?sys_id=1926ba5f6f31b100d756e6c16e3ee4e4&sys...


if is not embedded in a mailto template, it is working ok...



try the following:



${mailto:mailto.approval} where "mailto.approval" refers to another email template the contents of which would be: <img src="img_path" alt="Click to approve" />



As soon as you do that, it stops working...


Kalaiarasan Pus
Giga Sage

this is a working piece



"<table border='0' width='100%' valign='top' cellspacing='0' cellpadding='0' empty-cells='show'><tr><td><img src='"+gs.getProperty('glide.servlet.uri')+"PleaseReadBanner.gifx'></img></td></tr>"


Kuldeep Kumavat
Mega Guru

Hi Maros,



We are having a similar requirement, to make use of images in the notifications and redirect them to the mailto.



Using the template does not seem to be working; as there is no way we can make the image refer to the template. I've tried the below. But it would display text from the Template to make it reference; in addition to the image.


<a href = ${mailto:mailto.approval}>


<img src="/thumbs_up.pngx" alt="Approved" width="100" height="100"/> </img>


</a>



Below is what we tried and as of now it is working.



<a href="mailto:instance-name@service-now.com?Subject=Re:${number}%20-%20Approved&body=Approved">


<img src="/thumbs_up.pngx" width="100" height="100" onclick="target=${sys_id}"/> </img>


</a>



Let me know whether this works for you.


Though, we are still looking on; how we can embed the template in the notification to accomplish this.



Regards,


Kuldeep


Kuldeep,



my solution is to use a business rule on the sys_email table as shown below:



1. I created a new email template called "mailto.approval_img". The message field has "replace_approve" in it.


2. a new Before business, which runs "On Insert" and executes this:



(function(){


     


      current.body =   current.body.toString().replace('replace_approve', '<img src="/thumbs_up.pngx" width="100" height="100" alt="Click here to approve" /><br />Approve').replace('replace_reject', '<img src="thumbs_down.pngx" width="100" height="100" alt="Click here to reject" /><br />Reject');


 


})()



the above code does both Approvals and Rejections...



What do you think?



Cheers