setRedirectUrl(url) in new tab

rajendraksingh
Kilo Contributor

Hi,

I have crated an UI action where I am calling above funciton to fire a url.

This works fine but the url is opened in the current tab.

I want it to be opened in the new tab? How can this be achieved

My code is something like

function runUIAction() {

current.update();

action.setReturnURL(current);

action.setRedirectURL('$sw_dashboards.do?sysparm_viewid=' + current.sys_id );

}

Thanks

2 REPLIES 2

Geoffrey2
ServiceNow Employee
ServiceNow Employee

Opening a new tab has to be done on the client-side. You can do that with a Client UI Action.



Capture.PNG


Hi,



You can try with using a UI page name in action.setredirectURL(UI page name) and then add below script on the UI page.


I haven't tried it yet but its worth a shot.



Just replace your redirect URL in the window.open method. If you have some parameters, then you can pass in with UI page URL and then use RP.getparamter to decode them and append to redirect URL


find_real_file.png




Please mark correct/helpful based on the impact of the response.




Thanks


Gaurav