- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2018 09:01 AM
Hi all,
I have to insert an image in a notification. However, the image changes according to some data.
How can I insert the image via a client script? So to do a script check that depending on some data takes an image. Only the src will change.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2018 09:15 AM
Hi,
create a script e-mail like this
(function runMailScript(current, template, email, email_action, event) {
var image = '';
if( /*condition*/ )
image = 'image1.png';
else
image = 'image2.png';
template.print( '<img src="' + image + '" />' );
})(current, template, email, email_action, event);
Please mark this as "Correct Answer" if I have given you a sufficient answer to your question.
Best Regards,
Daniele

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2018 09:09 AM
Hi there,
You need to use email scripts for that purpose.
In the email script evaluate your conditions and go with if else evaluations inside which you can print this content into template.
<p><img src="/10Things06a.png" width="513" height="334" /></p>
Where the image name changes in the evaluations (different images).
Thanks,
Saikiran Guduri (NOW)
Associate Certificate Engineer | ServiceNow Store Apps
(Please mark the answer as correct answer/helpful/accept the solution if it helps)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2018 09:15 AM
Hi,
create a script e-mail like this
(function runMailScript(current, template, email, email_action, event) {
var image = '';
if( /*condition*/ )
image = 'image1.png';
else
image = 'image2.png';
template.print( '<img src="' + image + '" />' );
})(current, template, email, email_action, event);
Please mark this as "Correct Answer" if I have given you a sufficient answer to your question.
Best Regards,
Daniele

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2018 02:53 PM
Hi,
Can I put a URL link or mail script link behind that image?
So if I had an image saying 'Make a comment' can I have the URL to take them to the portal on the current record when clicking on that image?
Thanks,
Stacy