How to open a new window using UI action javascript after clicking a button?

calvinlo
Kilo Explorer

I have tried to create a UI button and want to open a new window with a url using the button.

It seems that window.open does not work and I notice that there is a function action.setRedirectURL().

Does anyone how to open a new window?

14 REPLIES 14

Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

I would use g_form.navigation. Something like this:


find_real_file.png


Finally after months of looking for a solution the above post works for me in Jakarta for a custom Scoped application.



The only change I required was:


no semicolon at end of Onclick (the form deletes the semicolon on field change...)


works.png


Happy to hear Lon 🙂


Suri2
ServiceNow Employee
ServiceNow Employee

window.open does not work for me, but g_navigation.openPopup('url') works. Thank you.

niket
ServiceNow Employee
ServiceNow Employee

Use 

g_navigation.open('URL','_blank');

use _blank if you want to open url in the new tab.