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.

UI Page Processing script redirect to another page issue

Tadz
Kilo Sage

Hi I have a UI Page which is called via GlideDialogWindow functionality.

In my processing script i have a code that would redirect to a specific page.

The issue is when I run this specific script:

var instanceName = gs.getProperty('instance_name');

var urlOnStack = "https://"+instanceName+".service-now.com/test/test.do?sysparm_document_key=test," +parentSysID;

response.sendRedirect(urlOnStacks);

The UI Page that is called via glidewindow just got wider or it got redirected to the UI Page I built but when I checked the URL its the correct URL.

But when I run this script (it working fine but It will just redirect to the same page, what I want is to redirect to another page):

var urlOnStacks = GlideSession.get().getStack().bottom();

response.sendRedirect(urlOnStacks);

Is there another way to redirect it?

Thanks,

Tadz

12 REPLIES 12

Nope, I mean window.open('/class_test.do','_self'); is still reopening new tab even though I'm using chrome.


Thats why i used top.window.location = '/class_test.do';


But it's not working on IE 11 on my end.




Hi Cris,



Try with GlideURL



function showSite() {  


var instanceName = gs.getProperty('instance_name');


var urlOnStack = "https://"+instanceName+".service-now.com/test/test.do?sysparm_document_key=test," +parentSysID;


var url = new GlideURL(urlOnStack);  


var w = getTopWindow();  


var newWindow = w.open(url.getURL(), "_blank");  


newWindow.focus();  


return false;  


}



Hope this helps.



Regards


Ujjawal


Jamison Cote2
Mega Expert

Old thread, but this might save someone some time if looking to accomplish a redirect properly on the server side. 

After referencing other OOB UI Pages with Processing Scripts that redirect after submission, it looks like this works:

response.sendRedirect(projectTable + ".do?sys_id=" + project_id);