Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

How to Get paremeter value from public survey url

JackieZhang
Kilo Sage

I have a req for adding the read only question User Name to a public survey. the value of User Name need to get from URL. how to implement it? 

2 REPLIES 2

soumyadeep10
Tera Guru

Hi @JackieZhang ,

You can use the below logic to get the user name and then you can add your own code if you want to set it to a particular field or anything else.

 var gUrl = top.location.href; //getting the URL
//fetch the parameter from url, add the replace the param_name with your parameter name.
    var uName = new URLSearchParams(gUrl).get("param_name"); 

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Ankur Bawiskar
Tera Patron

@JackieZhang 

where is the user taking survey? portal or native?

share screenshots

what's your actual business requirement?

check this

Setting value of survey question via client script 

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader