Clickable link not working in email script

anirban300
Kilo Guru

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>');

********************************************************************************

1 ACCEPTED SOLUTION

SanjivMeher
Kilo Patron
Kilo Patron

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.

View solution in original post

5 REPLIES 5

Ct111
Tera Sage

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

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?

SanjivMeher
Kilo Patron
Kilo Patron

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.

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?