Sending survey link in notifications: need help

Nowlearner
Kilo Guru

I want to include survey link in the incident closure notification.

I built a survey and enabled public access so that i can include the survey url in the incident closure email to take surveys.

This is the URL i need to include in the email:

Click here: https://dev56002.service-now.com/sp?id=public_survey&type_id=87186844d7211100158ba6859e610378

But i want the URL to be displayed as 'Take survey' so that it redirects to the above URL?

Can someone help me with writing the mail script?

The notification i am writing to include this survey link is written on incident table

I tried this mail script below:

var link = new AssessmentUtils().getAssessmentInstanceURL(current.sys_id);
var url = '<a href="' + link + '">here</a>';
template.print(url);

But when i clicked on the link it is displaying as invalid URL

 

1 ACCEPTED SOLUTION

Prateek kumar
Mega Sage

Hello Nikitha

Try this

var link = new AssessmentUtils().getAssessmentInstanceURL(current.sys_id);
var url = '<a href="' +link + '">' + 'Please click here to take Survey' + '</a>';
template.print(url);


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

View solution in original post

10 REPLIES 10

Pooja Singh2
Tera Contributor

you can write this in the email script:

var gr = new GlideRecord('asmt_assessment_instance');

gr.addQuery('trigger_id', current.sys_id);

gr.query();
if (gr.next()) {
var instance = gr.sys_id;
}
var record = current.sys_id;
var instancesurvey = gs.getProperty('glide.servlet.uri') + 'sp?id=take_survey&instance_id=' +instance;
template.print(instancesurvey);