how to open a new tab when you click a UI Action button?

Faraz2
Tera Contributor

here is script i am using in my UI Action:

 

var change = new GlideRecord("change_request");
change.initialize();
change.short_description = current.short_description; 
change.description = current.description;
change.cmdb_ci = current.cmdb_ci;
change.priority = current.priority;
change.assigned_to = current.assigned_to;
var changesysID = change.insert();
gs.addInfoMessage("Change " + change.number + " created");
action.setRedirectURL(change);
action.setReturnURL(current);

 

 

i am trying to open a new tab when i click on a UI Action button.

any help would be appreciated.

Thanks

16 REPLIES 16

Gunjan Kiratkar
Kilo Patron
Kilo Patron

Hi,

Set your UI action to client and try the following:

g_navigation.open("URL", "_blank"); //copy the url of the page you want to open in new tab

 

Regards,

Gunjan


Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

Already tried but its not working.

@Faraz2 I am in a similar situation as you. Have you managed to achieve your goal?"

Mohit Kaushik
Mega Sage
Mega Sage

Hi Faraz,

You can use anchor tag where in href you can provide your link and and in the target value you can pass _blank. This will help you open a new window with the click of your UI action.

<a href="https://www.w3schools.com" target="_blank">Visit W3Schools!</a>

 

Please mark this answer as correct and helpful if it resolves the query and helpful alone if it lead you in right direction.

 

Thanks,

Mohit Kaushik

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)