How to change URL query parameter dynamically

sobitha
Kilo Contributor

Can anyone help on the below script how to pass the caller value in the url parameter since its not working.

var gr = new GlideRecord('incident');

.

.

.

gr.query();

if (gr1next()) {

var caller=gr.caller_id;

var url="https://xxxxxx.service-now.com/nav_to.do?uri=incident.do?sys_id=-1%26sysparm_query=short_description... reset^caller_id=caller";

top.window.location = url;

}

Regards,

Sobitha

3 REPLIES 3

Patrick DeCarl1
ServiceNow Employee
ServiceNow Employee

if (gr1next()) {   should be if (gr.next()) {



var url="https://xxxxxx.service-now.com/nav_to.do?uri=incident.do?sys_id=-1%26sysparm_query=short_description... reset^caller_id="+caller;   <-- changed


Raju Koyagura
Tera Guru

try something like below...



var gr = new GlideRecord('incident');


.


.


.


gr.query();


if (gr.next()) {


var caller=gr.caller_id;


var url="https://xxxx.service-now.com/incident_list.do?sysparm_query=caller_id="+caller;


top.window.location = url;




}


mayurt
Tera Expert

Adding to what patrick said write url as below :




var url="https://xxxxxx.service-now.com/nav_to.do?uri=incident.do?sys_id=-1%26sysparm_query=short_description... reset^caller_id=" +caller;




Hope this helps



Regards,


Mayur