As you may well know, in the Helsinki release of the platform, we introduced the Service Portal. In the base system, there is a Script Include named SPEntryPage. This record is designed to work in conjunction with the system property glide.entry.first.page.script to control the login behaviour of an end user when attempting to access an instance. Unfortunately, in Helsinki and the early versions of the Istanbul release of the platform, we see that the SPEntryPage Script Include does not behave as described in the document site below.

https://docs.servicenow.com/bundle/helsinki-servicenow-platform/page/build/service-portal/concept/c_RedirectToSPAfterLogin.html#c_RedirectToSPAfterLogin

 

We have updated the article above now, but in a previous incarnation of this article, there was a mention that the SPEntryPage script contained a function that redirected any end user account attempting to access an instance to the Service Portal, on the condition that the end user account was not configured with a role.

 

I would invite you to review your SPEntryPage script, in line 69 of the Script Include record there is a condition that looks for a user role as a control. On a base system you will see the following code defined:

 

if (user.hasRoles() && !redirectURL && !isServicePortalURL)

 

The above code snippet is problematic as there is no variable user defined in SPEntryPage record. The condition will therefore never trigger. Service Now is well aware of this issue and will be addressing it in later releases of Helsinki and Istanbul.

 

This issue can be corrected by updating the Script Include from line 60 - 69 with the following code:

 

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;