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 Kim,

were you able to resolve this?  

I'm having a very similar issue. 

 

Thanks

John Quinonez