- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2023 03:37 AM
Hello All,
A simple question that I'm stuck on and couldn't find an answer to.
I created a Survey that is sent to Contacts in the ServiceNow system (they get a mail with a link to the survey)
when they open the survey a Survey instance is created.
is there any way to automatically get the name or email of the user that opened the survey and match\update it to the instance of that survey?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2023 11:22 PM
Hi,
Here are the steps:
- Create a new field (e.g., "Contact Email") on the Survey [asmt_metric_instance] table to store the email of the user who responded to the survey.
- Modify the URL of the survey invitation email to include the email of the contact as a parameter (e.g., https://<yourinstance>.service-now.com/<survey_url>?email=<contact_email>).
- In the Survey [asmt_metric_instance] table, create a new Business Rule that triggers on "Insert" and "Update" actions.
- In the Business Rule script, use the "current" variable to get the email address of the user who responded to the survey from the "email" parameter in the URL.
- Set the value of the "Contact Email" field to the email address of the user who responded to the survey.
Here is an example Business Rule script:
(function executeRule(current, previous /*null when async*/) {
// Get the email address of the contact from the URL parameter
var contactEmail = current.variables.u_survey_url.getURLParameter('email');
// Set the value of the "Contact Email" field
current.u_contact_email = contactEmail;
})(current, previous);
Thanks,
Rahul Kumar
Thanks,
Rahul Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2023 11:01 AM
@Max Beil Out of the box, there is 'Assigned To' field on the asmt_assessment_instance table. It should contain the user (ref to sys_user table) who survey was sent to. I believe responder should be the same user as the recipient of the survey, SN security will prevent someone else from taking it.
Maybe you are doing something with anonymous surveys, in which case the solution above provided by Rahul Kumar should do the trick.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2023 11:22 PM
Hi,
Here are the steps:
- Create a new field (e.g., "Contact Email") on the Survey [asmt_metric_instance] table to store the email of the user who responded to the survey.
- Modify the URL of the survey invitation email to include the email of the contact as a parameter (e.g., https://<yourinstance>.service-now.com/<survey_url>?email=<contact_email>).
- In the Survey [asmt_metric_instance] table, create a new Business Rule that triggers on "Insert" and "Update" actions.
- In the Business Rule script, use the "current" variable to get the email address of the user who responded to the survey from the "email" parameter in the URL.
- Set the value of the "Contact Email" field to the email address of the user who responded to the survey.
Here is an example Business Rule script:
(function executeRule(current, previous /*null when async*/) {
// Get the email address of the contact from the URL parameter
var contactEmail = current.variables.u_survey_url.getURLParameter('email');
// Set the value of the "Contact Email" field
current.u_contact_email = contactEmail;
})(current, previous);
Thanks,
Rahul Kumar
Thanks,
Rahul Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2023 11:34 PM
Thank you for marking my response as helpful.
If my response helped please mark it correct and close the thread.
Thanks,
Rahul Kumar
Thanks,
Rahul Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2023 11:42 PM
I will check your solution soon and will close the thread after,
Thank you for the amazing explanation and step by step guide!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2023 11:01 AM
@Max Beil Out of the box, there is 'Assigned To' field on the asmt_assessment_instance table. It should contain the user (ref to sys_user table) who survey was sent to. I believe responder should be the same user as the recipient of the survey, SN security will prevent someone else from taking it.
Maybe you are doing something with anonymous surveys, in which case the solution above provided by Rahul Kumar should do the trick.