- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2018 02:45 AM
I have an email script where I am using a script include "Assessment" to fetch an URL.When checked in log link2 contains the URL.But when used in template.print then the variable link2 is fetched when clicked on the image "Anirban4.jpg" instead of the URL.Can some one suggest how to store the URL in a variable and then used in template.print?
******************************EMAIL SCRIPT********************************
var link2 = new Assessment().getITAssessmentInstance(current.sys_id);
gs.log("URL="+'link2");
template.print('<a href="link2"><img src="Anirban4.jpg"/></a>');
********************************************************************************
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2018 10:58 PM
Correct your script to
var link2 = new Assessment().getITAssessmentInstance(current.sys_id);
gs.log("URL="+link2);
template.print('<a href="'+link2+'"><img src="Anirban4.jpg"/></a>');
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2018 04:50 AM
Hi Make
chnges something like below for LINK in email script
template.print('<a href="https://' + gs.getProperty('instance_name') + '.service-now.com/nav_to.do?uri=incident.do?sys_id=' + gr.sys_id + '">' + gr.number + '</a>');
Mark my ANSWER as CORRECT and HELPFUL if it helped
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2018 10:54 PM
The URL is stored in a variable.This cannot be possible what you are suggesting. How can an URL stored in the variable be used in template.print?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2018 10:58 PM
Correct your script to
var link2 = new Assessment().getITAssessmentInstance(current.sys_id);
gs.log("URL="+link2);
template.print('<a href="'+link2+'"><img src="Anirban4.jpg"/></a>');
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2018 02:51 AM
Hi Sanjiv,
Thank you for your response. Do you have any idea of one of my other query?
We are building Smiley Survey in our system.We are presently stuck on one issue.
We have created a notification with 3 smileys(Satisfied, Okay , Dissatisfied) and each smiley contain the URL of the Survey.We have also created a survey with the same 3 smiley's.
So when "Satisfied" smiley is clicked in email, then it should redirect to the survey page with "Satisfied" smiley pre clicked on the survey page as well.
How can we achieve this?Do we need to send extra data through each URL so that we can use a client script to fetch the data and use it to make the smiley true? Can you tell me how to do this?