UI Action setRedirect not working on external link
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2018 01:26 PM
While trying to do a action.setRedirectURL to an external link, when I run the UI action, nothing happens. ServiceNow goes to a blank screen.
Code is as follows but I am at a loss as to understand why this is happening:
var url = 'http://www.yahoo.com';
action.setRedirectURL (url);
The Yahoo Link is just there for show and it won't go to the URL itself. This has been set up to be a non-client UI action so I'm not sure what I'm missing.
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2018 07:25 PM
If your UI Action is also updating the record ( current.update() ), the redirect may get superseded by a gs.setRedirect in a business rule.
Check all business rules on that table for gs.setRedirect()
If you can't get around that issue, you can use the following pattern to open the URL in a new window using a Client Side UI Action that still runs server code.
function yourUIAction() {
var url = "www.google.com";
g_navigation.open(url,window);
g_form.save();
}
if(typeof window == 'undefined')
yourServerCode();
function yourServerCode() {
current.field = "xyz";
//etc
}
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2018 04:46 AM
The UI Action only has the redirect. No update code.
And due to CAB rules, this needs to be a server side redirect.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2018 08:17 AM
Also, tested this out on an Istanbul test instance. Code also does not work there either.
Is there something specific about redirects on Istanbul that are not working in this case?
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2018 05:25 PM
Can you post the code and the UI Action?
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022