- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2012 03:36 AM
Can we redirect to any other page or homepage using client script.
I need that if the IF condition true then redirect to homepage.Please help me out
Solved! Go to Solution.
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2019 12:44 PM
I know this post is old and Harsh might have got his answer but just in case someone stumbles upon this post and looking for a way to redirect using client script then below code snippet might help:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
if (newValue == 'expense_freight_realestate'){
var redirectURL = 'https://www.google.com/'; //url to redirect; this approach works in platform and Service Portal view
top.window.location = redirectURL ;
}
}
Please note that in case you want to open up external link within the main ServiceNow Frame then you may use g_navigation.open() but this approach doesnt work when the Service Catalog/form will be used in Service Portal.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2020 05:43 PM
Hi Ripu,
I used the mentioned onChange script but without success
Requirements:
If variable (what_would_you_like_to_do) selection changes to 'Create New Catalog Item' then redirect to https://mhsdev.service-now.com/sp?id=sc_cat_item&sys_id=70651f5c1b55141027a8620bbc4bcb92
=====Here is the onChange script I am using=====
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
if (newValue == 'Create New Catalog Item'){
var redirectURL = 'https://mhsdev.service-now.com/sp?id=sc_cat_item&sys_id=70651f5c1b55141027a8620bbc4bcb92';
top.window.location = redirectURL ;
}
}
see attachment for screenshot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2023 09:15 PM
I Guess the above does not work for on summit client script in catalog item ?
That too in scoped app.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2023 06:38 PM
Hi Shiven
I have tried this recently in on-submit client script. The solution provided by Ripu should work. If this is not working, then try with below.
var url = "YOUR URL"
top.window.onbeforeunload = null;
top.window.onunload = null;
top.window.location = url;