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

Hi Cris,



You can open the window in new tab by specifying extra parameter in window.open() method


window.open('/class_test.do', '_blank').


Try this



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Anku,




I think it still opens new tab.


Hi Cris,



you want it to open in new tab right?


Or you want it to open in same tab. -> If yes then give the other parameter value i.e. _self



window.open('/class_test.do', '_self').


Try this.



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Yup I want to redirect it to the same tab.


But window.open('/class_test.do', '_self').




does not work.



I tried, top.window.location = 'url';


it works, but its not working on Internet Explorer


Hi Cris,



Are you saying that window.open('/class_test.do','_self'); is working fine in Chrome, Firefox but not in IE (which version)?


May be you can check below links which will help you:



javascript - window.open not working in IE - Stack Overflow


javascript - window.open() not working in IE11 - Stack Overflow


https://connect.microsoft.com/IE/feedback/details/812072/ie-11-window-open-issue



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader