https://express.servicenow.com/support/forums/topic/how-to-pass-an-incidentrequest-to-a-survey/


Figured it out!

– Create Survey (example name: Incident Survey)
– Create text question “Incident #”
– Set the question default to: javascript:RP.getParameterValue(“incidentnum”)

Don’t put a ; at the end of the javascript, put it in exactly as it shows above.

Now if you add the incidentnum parameter to the URL, it’ll fill it into the question. Unfortunately I haven’t been able to find a way to get it to make the question read-only.

Here is an example URL that opens the Survey and fills in the “Incident #” question. Make sure to URL encode the & as %26

https://instance.service-now.com/nav_to.do?uri=survey_take.do?sysparm_survey=Incident+Survey%26incidentnum=INC12345

Obviously you can use this to pass whatever values you want by adding multiple parameters to the URL, just make sure to use %26 to separate the parameters, not &

One other thing. By default, each time a user takes a survey it overwrites the previous time they took it. You can force it to create a new survey instance (set of responses) each time by using this URL parameter:

sysparm_survey_update=false

So to put it all together, this URL passes the Incident # and forces it to create a new set of responses instead of overwriting the last time the user took it:

https://instance.service-now.com/nav_to.do?uri=survey_take.do?sysparm_survey=Incident+Survey%26incidentnum=INC12345%26sysparm_survey_update=false