Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Kashif Mughal I
Tera Explorer

This code can redirect you to new tab and as well as stay in current form of UI Action.

I hope this code will help you.

function openInNewWindow() { //Client Side scripting
curr_request = g_form.getValue('call_type');
if(curr_request=='sc_request'){ // request choicelist
var curr_item = g_form.getValue('request_item');
url="/sp?id=sc_cat_item&sys_id=" + curr_item; // redirect to service portal link
var win = window.open(url, '_blank');
win.focus();
}
gsftSubmit(null, g_form.getFormElement(), 'sysverb_insert_and_stay');
}

if(typeof window == 'undefined')
StayOnCurrentForm();

//Server-side function
function stayOnCurrentForm(){
current.insert();
action.setRedirectURL(current);
}
// code created on 25-01-2020

Version history
Last update:
‎01-25-2020 02:47 AM
Updated by: