Service Portal Logout Redirect Issue

mohammedunwala
Giga Contributor

Hello All,

We have a below requirement,

  1. If user with role(s) login they should see the ServiceNow page - Achieved
  2. If user with no role login they should be redirected to service portal page.- Achieved

I used the below code in SP entry page(60 to 69) and activated the below properties,

  • PROPERTY VALUE
  • glide.entry.page.script new SPEntryPage().getLoginURL();
  • glide.entry.first.page.script new SPEntryPage().getFirstPageURL();

getFirstPageURL: function() {
var session = gs.getSession();
this.logProperties('before', session);
var check = session.getRoles();
// 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 (check && !redirectURL && !isServicePortalURL)
return;

Issue: When the user without a role logs in first and logout, then the user with a role(s) logs in then they are viewing the SP home page. The landing login page seems to have '/sp' as the suffix and even when if the suffix is cleared it still redirects to the service portal for the user with a role(s) after log in, until I clear the cache of the browser (here: google chrome)

Can somebody comment on this behaviour?

Thanks and Regards,

Mohammed

6 REPLIES 6

lks
ServiceNow Employee
ServiceNow Employee

Hello Mohammed,



I hope you should find your answer here 6 ways to set up your Service Portal for redirection SUCCESS!


Let me know if it helps!


Karthik Reddy T
Kilo Sage

lSurya 24
Giga Guru

Hello Mohammed,



Use this property and make the value as true.



"glide.service_portal.use_login_redirect_script"



which will redirect users to sp who don't have any roles.


Hitesh targe
Tera Expert

I have the same issue.



were you able to resolve the issue?



please suggest.



Thanks