On Save button - Redirect to Service Portal and also stay on Form in UI Action
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 scriptingcurr_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 functionfunction stayOnCurrentForm(){ current.insert(); action.setRedirectURL(current);}
// code created on 25-01-2020
Labels:
https://www.servicenow.com/community/developer-articles/on-save-button-redirect-to-service-portal-and-also-stay-on-form/ta-p/2323802
