portal redirection

rambo1
Tera Guru

HI Team , 

we configured custom URL but for some reason custom url is redirecting all users to native view.

We dont have much time to fix this, so as a quick fix we want to modify SPentry page script include to redirect all users redirected to native view through idp to be redirected back to custom url (custom portal).

how to get this ?

I tried to modify line 22 on spentry page script include.

var customURL = "www.customurl.com";

this.portal=customURL;

but this is not redirecting users from native view to custom url.

4 REPLIES 4

Debasis Pati
Tera Guru

Hello @rambo1 ,

There is a oob script include which handles where to redirect the name of the script include is "SPEntryPage".
Note :This is a high risk script please amnd it and do through testing sample script is below:

var SPEntryPage = Class.create();
SPEntryPage.prototype = {
initialize: function() {
this.portal = '/custom_portal'; // Set your custom portal URL here
},

getFirstPageURL: function() {
var session = gs.getSession();
var redirectURL = session.getProperty('login_redirect');

// Redirect all users to the custom portal
if (!redirectURL) {
session.putProperty('login_redirect', this.portal);
return this.portal;
}

return redirectURL;
}
};

i would suggest before doing this change try to find out the root cause but for time being or so the provided solution is a workaround.

Please mark it as helpful/correct if this helps you.,

Regards,
Debasis



Veer
Tera Guru

@rambo1  Where did you configured the custom url? 
Modifying in the SPEntryPage script incude wont redirect you from native view to portal view. 

Ankur Bawiskar
Tera Patron
Tera Patron

@rambo1 

this article explains it well

6 ways to set up your Service Portal for redirection SUCCESS! 

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@rambo1 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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