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

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

Hi Ankur,

Thanks for your support.

It's working well If I want to open in a new window. What we do.

 

Thanks

Raj

Hi Raj,

Not sure whether this is supported currently by ServiceNow.

Saying this, I will appreciate if you close this thread, as answered.

Regards
Ankur

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