Image in email script which redirects to a survey link

anirban300
Kilo Guru

I want to use this image in an email script(Notification) so that when clicked on the image in email received then it redirects to servicenow. Below is the email script and I want to add the smiley on the end of notification.Can someone help?

find_real_file.png

{
template.print('<p><font size="3" color="#808080" face="helvetica">');
template.print(gs.getMessage('If you feel the issue is not resolved, please click the following link and reopen your incident:'));
template.print('</font></p>');
}
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="' + link + '"');
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);

1 ACCEPTED SOLUTION

template.print('<a href="ServiceNow Survey URL"><img src="URL"/></a>');

View solution in original post

6 REPLIES 6

Kalaiarasan Pus
Giga Sage
  • Load the smiley as an image in ServiceNow. 
  • Open the image that you loaded.
  • Copy the URL from the record.
  • Use the image URL in src attribute of <img> tag.
  • Add the img tag to email using template.print

Hello iamkalai,

 

Thank you for your response.I am actually new to servicenow.Can you please write the code so that I can understand it better? 

 

Regards

Anirban

You already have the code above and all I am asking you to do is follow the steps stated above.

Is it something like this?

 

<a href="ServiceNow Survey URL"><img src="URL"<mail_script>template.print(gs.getProperty('glide.servlet.uri'))</mail_script>></img></a>