Notifications

27 views

Description

This article will guide through configuring redirection for users after login. Essentially, we are asking the question: where does this user go after they login? and then configuring the logic to facilitate that redirection. If you are looking for information on how to configure where they go to log in then please refer to this article: How to Configure Service Portal as your instance login page.

Throughout the history of the platform this redirection has been configured using several different methods: login rules and installation exits, to name a few. When redirecting to service portal is in the picture, these old methods need to be removed and the primary configuration should be handled in the SPEntryPage script include.

Procedure

  1. Create or update the system property glide.entry.first.page.script. In some instances, this may already exist, but in many, it will need to be created as a String type property. Make sure to set the value to new SPEntryPage().getFirstPageURL() in order to invoke the SPEntryPage script.
    • In the base system, this is set to check if the user has any roles and is not trying to go the Service Portal directly. If both pass, then it will send them to value of the glide.login.home property or the page they were attempting to load prior to logging in. If the user does not have any roles, it will send them to the equivalent of that page in Service Portal

      For example:

      https://<instance_name>.service-now.com/change_requests_list.do

      will send non-role users to

      https://<instance_name>.service-now.com/sp/?id=list&table=change_request

  2. Configure the SPEntryPage script include to handle your specific needs: NOTE: This requires customization of the base system code. Hopefully, this guide will be helpful in that process however any configuration outside of what is described above is not supported.
    • Lines 69 and 70 of the SPEntryPage script are what determines whether or not to redirect a user. You'll see by default that if the user has roles, there is not an existing redirect URL (login_redirect) and the user is not attempting to go to the Service Portal, the script will return - meaning the user is not redirected. In order to tailor this functionality, this function needs to be modified - make sure to leave the second two checks in place or you could break existing functionality. The user.hasRoles check is really the only part that can be modified. For example if you want users with a specific role to go to the platform UI by default, you might change the condition to if(user.hasRole("my_cool_role") && !redirectURL && !isServicePortalURL) 

Applicable Versions

All supported versions

Additional Information

A couple of considerations when configuring this redirection:

  1. The purpose of spEntryPage is really two-fold: 1, where does the user go to log in? 2, where do they go after they're done logging in?. It really is not intended to completely prevent users from accessing the platform UI. 
  2. If you do have other existing redirection logic (login rules, installation exits, etc...) they will more than likely cause conflicts with this logic and lead to unintended results.
  3. Users with the admin role will always pass a hasRole check regardless of whether or not they have that specific role. This can be tricky when customizing SPEntryPage to check for users with a specific role.
  4. There really is not any supported way to redirect between multiple portals - this is intended to be a single portal configuration.

For more information on this topic please refer to 6 ways to set up your Service Portal for redirection SUCCESS! from the ServiceNow Community.

Article Information

Last Updated:2019-04-17 05:30:36
Published:2019-04-17