How can we open UI Pages in new Tab in UI Actions

Raj90
Tera Guru

Hi,

I have one UI Action Print on the form.

I'm calling Printing info UI Page in Print UI Action. It's working but it redirects to the current page. But I need to open Printing info UI page in new tab

UI Action script:

function openRepeatIncident() {
var dialog = new GlideDialogWindow("asp_apartment_printable_info");
dialog.setTitle(getMessage("Do you want to print the latest saved values of this form?"));
dialog.setPreference('warning', true);
dialog.setPreference('title', getMessage("Changes you made were not saved. The printing will be generated with the previously saved values."));
dialog.render(); 
}
function onPromptComplete(){
top.window.location = '/asp_apartment_printable_info.do?sysparm_sys_id='+ g_form.getUniqueValue() +'&sysparm_direct=true, target="_blank"';
}

I tried window.open in place of top.window.location, Then UI Action is not working.

top.window.location working but the UI page does not open in the new tab.

Anyone help me.

Thanks,

Raj

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Raj,

try this once

g_navigation.openPopup('/asp_apartment_printable_info.do?sysparm_sys_id='+ g_form.getUniqueValue() + '&sysparm_direct=true');

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

5 REPLIES 5

the script which you were using initially will work,can you confirm what exactly is happening when you hit the button ?