Generate URL to UI Page with parameters

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2016 07:09 AM
I have a UI page with the following jelly vars:
These variables, jvar_DEPT_record_sysID, jvar_userLoc, and jvar_userID are populated by a former UI page.
How and when this UI page is displayed is working great.
What I would like to do is generate a stand-alone custom link to get to the same UI Page, of course needing to pass all needed variables for the scripts to work.
Here is what I've come up with, but it does not work:
h t t p s : / / mydomain.service-now.com/bcp_DEPT_FULL_VIEW.do?sysparm_query=jvar_DEPT_record_sysID=4f47d5196f24d240da584e8f1e3ee452&sysparm_query=jvar_userLoc=f67413076f0111007906db3bbb3ee4cc&sysparm_query=jvar_userID=b6d861232b4bbd00df6426e405da1523
I feel that I'm not passing the sys_id's correctly for the UI page to set it's jvar varialbes to those ID's so it can run properly.
Any advice on how I can get a stand-alone URL to work like this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2016 08:07 AM
I might be missing something, but I think you are passing your parameters in wrong. Or at least, I would do it a different way.
I pass in my parameters like: sysparm_loc and sysparm_id because I reference them in my code like: <j:set var="jvar_location" value="${sysparm_location}" />
Therefore, I would do something like this as my URL:
h t t p s : / / mydomain.service-now.com/bcp_DEPT_FULL_VIEW.do?sysparm_loc=4f47d5196f24d240da584e8f1e3ee452&sysparm_id=f67413076f0111007906db3bbb3ee4cc
And my UI page would set the variables like so:
<j:set var="jvar_location" value="${sysparm_loc}" />
<j:set var="jvar_id" value="${sysparm_id}" />
I apologize if I am missing something obvious, but this is how we pass parameters into our UI pages and then load them into variables.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2016 06:10 AM
For some odd reason, it's not working.
I even followed all the advices from:
https://community.servicenow.com/thread/195466 and https://community.servicenow.com/thread/176149
I have this function in 1st UI page:
function openOutageDetails(recordNumber)
{
window.location.assign("https://mycompany.service-now.com/outages/outage_details.do?sysparm_recordNumber=" + recordNumber);
}
When the url is clicked, it opens up my second UI page just fine, and tacks on the correct recordNumber.
In this second UI Page, I have:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<j:set var="jvar_record_number" value="${sysparm_recordNumber}" />
<script>
console.debug("jvar_record_number: " + "${jvar_record_number}");
</script>
And here's what the console shows:
Nothing. It's blank.
I cannot figure out where it's breaking.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2016 06:27 AM
For now, albeit a hack, this will do the trick:
function parseURL()
{
var url = location.href;
var data = url.substring(url.indexOf('?') + 1);
var dataArray = data.split("=");
for (var i = 0; i < dataArray.length; i++)
{
console.debug("dataArray[i]: " + dataArray[i]);
}
console.debug('data: ' + data);
} parseURL();