Redirect to ITIL homepage using SPEntryPage

ayman_h
Kilo Sage
Kilo Sage

Hi,

I am having issues when users login using side_door.do. They are redirected to the ITIL homepage (nav_to.do?uri=/side_door.do) and the homepage contains a Page not found error as I am already logged in. To resolve this error I am trying to re-direct users to Welcome.do or home.do instead using the SPEntryPage script (getFirstPageURL). However, when I try to return "/nav_to.do?uri=/home.do", I get a browser error saying there has been too many redirects.

If on the script, I return other pages such as /welcome.do, I am just redirected to the page without the Application Navigator and Banner frame.

Does anyone have an idea how I could redirect to the ITIL homepage with the main frame containing either welcome.do or home.do?

Here is a quick snippet of the getFirstPageURL method inside SPEntryPage, I have highlighted the code in red which I am trying to fix.

getFirstPageURL: function() {

var session = gs.getSession();

this.logProperties('before', session);

gs.log("SPEntryPage Logs getFirstPage");

// has roles and is not a Service Portal page - go to UI16

var nt = session.getProperty("nav_to");

var isServicePortalURL = new GlideSPScriptable().isServicePortalURL(nt);

var redirectURL = session.getProperty("login_redirect");

if ((user.hasRole('admin')) && !redirectURL && !isServicePortalURL)

return;

if (user.hasRole('itil') && !redirectURL && !isServicePortalURL){

return "/nav_to.do?uri=/home.do";

}

// user may have logged in from a frame, the /login_redirect.do page will bust out of it

if (!redirectURL) {

// redirectURL is nav_to

// if nav_to == "welcome.do" then use starting_page

var sPage = session.getProperty("starting_page");

if (sPage && nt == "welcome.do")

nt = sPage;

// Avoid a redirect loop to the home page

if (nt) {

var ep = gs.getProperty("glide.login.home");

if (ep == nt)

nt = null;

}

session.putProperty("login_redirect", nt || "true");

gs.log("SPEntryPage Logs getFirstPage NT: "+nt);

return "/login_redirect.do?sysparm_stack=no";

}

session.clearProperty("login_redirect");

var returnUrl = this.portal;

if (redirectURL && redirectURL != "true") {

var spUrl = new GlideSPScriptable().mapUrlToSPUrl(redirectURL);

returnUrl = spUrl ? this.portal + "?" + spUrl : redirectURL;

}

this.logProperties('after', session);

return returnUrl;

},

logProperties: function(beforeOrAfter, session) {

if (!this.logVariables)

return;

},

1 ACCEPTED SOLUTION

Hey,


Yes, I did solve it in the end, I had an OnLoad UI Script, which was interfering with this script. I have also replaced the code in red, with just 'return;' instead of returning a specific URI. What issue are you currently facing?


View solution in original post

10 REPLIES 10

Hi- so I'm getting a too many redirects error in Chrome.   I checked, login rules are off and no UI Scripts.   Right now, admin and itil roles are set to do nothing in the SPEntryPage script include.



So I need 2 things:


1- get rid of the redirects issue


2- help with my script include to direct all users (except admin) to the SP but allow th to click a link and access navpage.



Thanks!


Can you paste your code here? Can you check if you have a UI Script that runs onLoad?



Thanks,


Ayman


Kim Sullivan
Tera Guru

Hi - code is the OOB SPEntryPage and no UI script.


Hi,



Can you confirm which version you are using?



Also, can you check the value of the System Properties - glide.home.page?



The other issue could be if nav_to is not public. To check this, you can go to sys_public.list and then check if "nav_to" is set to true or false.



Thanks,


Ayman


Hello --


Istanbul v glide-istanbul-09-23-2016__patch6-05-02-2017_05-19-2017


glide.home.page is home_splash.do?sysparm_direct=true


and nav_to is set to true.



Thanks.