- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2016 01:08 PM
Hi ServiceNow Community Developers
Is there a way to redirect from a UI Page to service catalog item form? I am able to do this from a UI Action however I am not able to do it coming from a UI Page. Basically what I would like to accomplish is after populating the fields in the UI page when I click OK I would like to switch to the service catalog item form view with the fields from the UI page auto populating the variables on the catalog item form. As I said with a UI action from a form I am able to do this - when I click the button I get switched to catalog item form view and all the fields that I want to carryover and they auto populate the catalog item form. Would you please advise if there is a way to accomplish the same functionality coming from a UI page.
Thanks,
Johannes
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2016 10:34 AM
Hi Guys,
I got it to work. I moved the code from the client script to the Processing script and it's redirecting as expected and its carrying through all the fields and its auto populating the variables on catalog item form
Thanks to all of you for your help
Here is code that works for me:
if (cmn_building != "") {
var url =
'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=617eb4d60f2b56001820e388b1050e3f' +
'&sysparm_consumable='+consumable +
'&sysparm_building='+cmn_building +
'&sysparm_quantity='+qty +
'&sysparm_business_unit='+business_unit;
// window.location = url;
response.sendRedirect(url);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2016 01:26 PM
Hi Johannes,
You may find the below thread helpful.
Is it possible to redirect to a map page from client script of a UI page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2016 01:55 PM
As Pradeep mentioned, you could do this with a window.location = 'some URL'; to get to the location.
Getting the fields to auto-populate is going to be a bit more challenging. One approach I could see is pass all your variable values in the URL.
var url = '?sysparm_count=' + g_form.getValue('count') + '&sysparm_user=' + g_form.getValue('user') ... ;
Then on the catalog item, use an onLoad client script to grab them and fill them in.
var gURL = new GlideURL();
gURL.setFromCurrent();
g_form.setValue('count', gURL.getParam("sysparm_count"));
// Add other parameters & variables here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2016 04:20 PM
Hi Guys,
Thanks for your responses.
This is what I have inside the client script part of the UI page but it does not seem to be working:
var url =
'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=617eb4d60f2b56001820e388b1050e3f' +
'&sysparm_consumable='+asset_id +
'&sysparm_building='+to_building +
'&sysparm_quantity='+quantity +
'&sysparm_business_unit='+business_unit;
window.location = url;
Any idea what is it I am doing wrong? Kindly advise.
Thanks,
Johannes

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2016 04:24 PM
Hi Johannes,
What is it doing (or not doing?)
Is that the sys_id of the catalog item or record producer (sc_cat_item) record where you want to land?