Need Help in Passing Variable Values to URL

kamma_priya
Giga Expert

Hi All,

I have requirement pass variables values in URL parameters.

EX: When user is trying to open blocked site it will populate window stating that you don't have access this site, Please create Service Catalog request to get the access. (window will have link to service catalog item).

When user click on Service catalog link, catalog item page will open in servicenow; We have requirement to prepopulate URL and URL category in the catalog form and user wants to manfully submit the request in ServiceNow (Manually click order now button)

Can we add variables values using URL parameters; so that when user click on link in window in blocked site it should open catalog item page and should prepopulate variables.

Thanks,

Priya

 

 

1 ACCEPTED SOLUTION

kamma_priya
Giga Expert

Portal :

var site = top.location.href;
var input1 = new URLSearchParams(site).get("sysparm_input1");
var input2 = new URLSearchParams(site).get("sysparm_input2");

 

Native View:

var gUrl = new GlideURL();
gUrl.setFromCurrent();

var input1= decodeURI(gUrl.getParam('sysparm_input1'));
var input2 = decodeURI(gUrl.getParam('sysparm_input2'))

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0783157

View solution in original post

2 REPLIES 2

Geoff_T
Mega Sage

Hello,

Check out my accepted solution here for a similar request:

https://community.servicenow.com/community?id=community_question&sys_id=fe24fe67dbb8741013b5fb243996190d

This should hopefully answer your question.

 

Geoff

kamma_priya
Giga Expert

Portal :

var site = top.location.href;
var input1 = new URLSearchParams(site).get("sysparm_input1");
var input2 = new URLSearchParams(site).get("sysparm_input2");

 

Native View:

var gUrl = new GlideURL();
gUrl.setFromCurrent();

var input1= decodeURI(gUrl.getParam('sysparm_input1'));
var input2 = decodeURI(gUrl.getParam('sysparm_input2'))

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0783157