- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2018 06:43 PM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2018 08:23 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2018 07:37 PM
What is the value of `link` when it's failing?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2018 09:29 PM
This is the link it is redirecting to:
https://dev56002.service-now.com/sp?id=take_survey&instance_id=9c573169c611228700193229fff72400.
Not sure whats happening here.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2018 09:42 PM
new AssessmentUtils().getAssessmentInstanceURL(current.sys_id);
The above code gets the URL for a specific survey for a specific instance where a survey has been "issued" where you might say "for 30% of users, create a survey".
I believe if you replace that code with;
new AssessmentUtils().getAssesmentTypeURL("sysIdOfasmt_metric_typeRecord");
It should work. The new `asmt_metric_type` table has your survey definitions, so just hard-code your sysid or make a property, and refer to that instead.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2018 02:31 PM
Thank you!
My survey is enabled public access, even the non logged in users can take the survey and people can take this survey multiple times.
because public survey doesnt have any restrictions in servicenow.
Is there any possibility that our instance can be hacked????????
or can we write any script that only a logged in user can take a survey and only can take this survey single time????????