Open URL in new blank window
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2023 01:58 AM - edited 12-21-2023 02:02 AM
HI Everyone,
I have created one UI Action to launch one custom URL. I am using Client side and Server side both in one UI Action. So, to launch an URL I am using gs.setRedirect(URL) . But it opens that URL in same window rather than opening on new window.
Ex: I have this UI Action on incident form. Once this UI Action is clicked it open's the URL in same window. Whereas I want to open the URL in new window and keep the incident form as it is.
Please help me in finding some solution. I have attached code of my UI Action below.
cc: @Ankur Bawiskar
Thanks in advance
function Popup() {
gsftSubmit( null, g_form.getFormElement(), 'popup_itsm');
}
if (typeof window == 'undefined')
serverReopen();
function serverReopen() {
var URL = "https://www.google.com" // a custom URL will be used here, I have used it only as example
gs.setRedirect(URL);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2023 02:22 AM
Hi @Virendra Dwived ,
function Popup() {
gsftSubmit( null, g_form.getFormElement(), 'popup_itsm');
}
if (typeof window == 'undefined')
serverReopen();
function serverReopen() {
var URL = "https://www.google.com" // a custom URL will be used here, I have used it only as example
g_navigation.openPopup(URL);
}
Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2023 02:27 AM - edited 12-21-2023 02:27 AM
I used your suggestion but now the button has stopped working. When I click on UI action it does not open URL. Rather it open's same UI Action's form.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2023 02:39 AM - edited 12-21-2023 02:43 AM
Hi @Virendra Dwived ,
Mark sure client callable checked, Action name in ui action should be popup_itsm, Onclick funtion should be- Popup();
Try below one
top.window.location ="https://www.google.com";
var url = 'https://community.servicenow.com/';
window.open(url,'_blank');
If you want to get server side data and when click on that url navigate to data refrer below link
https://www.servicenow.com/community/developer-forum/ui-action-redirect-to-a-new-window-tab-using-se...
Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2023 02:28 AM - edited 12-21-2023 02:35 AM
Hi,
function Popup() {
g_navigation.open('https://www.google.com','_blank');
}
You can do it in client script as GlideNavigation is a client side API.
GlideNavigation | ServiceNow Developers
Thanks and Regards,
Saurabh Gupta