- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2023 12:36 AM - edited ‎02-24-2023 12:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2023 01:47 AM
g_navigation won't work in portal.
you need to use top.window
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (newValue == 'some value'){
var redirectURL = 'https://something.service-now.com/itsp?id=sc_catalog_item&sys_id=something';
top.window.open(redirectURL, "_blank");
}
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2023 12:48 AM
Hello @Aakash007
You can refer to the client script below:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
if (newValue == 'NEW_FIELD_VALUE'){
var redirectURL = 'https://www.google.com/';
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.
You can also refer to this community post here - https://www.servicenow.com/community/itsm-forum/can-we-redirect-using-client-script/m-p/385003
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2023 01:07 AM - edited ‎02-24-2023 01:07 AM
Hi Satyakibose
1. I need to redirect form on Service portal.
2. I am getting "g_navigation is not difined" on console
Thank you

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2023 01:12 AM
Hello @Aakash007
Client scripts work differently when compared to native UI & service portal in terms of redirection.
Please check the KB article here: Redirect does not work in Service Portal - Support and Troubleshooting (servicenow.com)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2023 01:23 AM
since you are in portal top.location will work fine
can you share what script you used and what's not working?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader