UI Action setRedirect not working on external link

tahnalos
Kilo Sage

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.

21 REPLIES 21

I think the cabrillo API is specific only to the Mobile App (the one you download on the store).


ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

That's fine and all, but how do I code with it?  There is nothing in the documentation on how I can instantiate it on my instance, and any attempts to put in cabrillo code results in a compiler error.

Munender Singh
Mega Sage

Hi,

Can you plz go and check if the gs.setRedirect() id bring used in any of the BR on your table

If so,kindly comment it out and then,check if it works.

 

Regards,

Munender

Vignesh21
Kilo Guru

HI,

Can you try this below function which has example of google.

 

function redirecta()

{

window.open("https://www.google.com", "_blank");
}

 

 

Call redirecta(); function onClick.

 

Let me know if you were able to achive it.

 

Regards,

Vignesh

window.open should be avoided:

ServiceNow Best Practice - Avoid DOM Manipulation.

g_navigation, action.setRedirectURL and gs.setRedirect exist in it's place.


ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022