UI action to open in new window/Tab

Prashant Kumar6
Giga Guru

Hello Experts, 

 

I have created a UI action on story form (rm_story) to create test case (tm_test_case), which is working fine . Now I want to open that in new Tab of the browser , for that I used below code and it is not working . When I used Log it is showing "com.glide.script.RhinoEcmaError: "window" is not defined." 
Note : Isolated script : false . Can anyone please help here?

create_test();
 
function create_test(){
var url;
var TMTC1 = '';
var TMTC = new GlideRecord('tm_test_case');
 TMTC.initialize();
 TMTC.u_type = current.u_test_case_type;
  TMTC1 = TMTC.insert();
 
url = '/tm_test_case.do?sys_id' + TMTC1;
gs.log("Prashant1" + url);
window.open(url,'_blank');
}
2 ACCEPTED SOLUTIONS

Samaksh Wani
Giga Sage

Hello @Prashant Kumar6 

 

try this once :-

 

 

 

g_navigation.open(url);

 

 

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Samaksh

View solution in original post

praneeth7
Tera Guru

Hello @Prashant Kumar6 

 

This link might help you on this How to Open an URL in New Window from UI Action? 

 

Please mark Helpful if you find this useful. 

Thank you

Praneeth 

View solution in original post

10 REPLIES 10

Hi @Prashant Kumar6,

 

It should work for you.

gs.setRedirect(url, '_blank');

 

If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers.
Thanks,
Sagar Pagar

The world works with ServiceNow

Hi @Sagar Pagar 
Unfortunately , it does not open in a new tab. I believe window.open(); should work dont know why this is not working . 

Samaksh Wani
Giga Sage

Hello @Prashant Kumar6 

 

try this once :-

 

 

 

g_navigation.open(url);

 

 

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Samaksh

praneeth7
Tera Guru

Hello @Prashant Kumar6 

 

This link might help you on this How to Open an URL in New Window from UI Action? 

 

Please mark Helpful if you find this useful. 

Thank you

Praneeth 

Prashant Kumar6
Giga Guru

Yes , I end up creating an Script include and Ui action to achieve this with window.open(url,'_blank') and now it is working . Thanks all . Cheers !