Controlling ServiceNow traffic by redirecting users to your Service Portal

As organizations increasingly rely on ServiceNow to streamline their operations, managing user access and navigation also becomes increasingly important. This NOW You Know article explores an essential aspect of Service Portal maturation: controlling user traffic and ensuring proper redirection to improve both security and the user experience.

The process of maturing a Service Portal involves more than just building out Catalog items and adding a few widgets or reports. Controlling portal traffic and making sure end users are being routed to the correct place is just as important. Many times a company will want to route users who have a valid ServiceNow account, but no ServiceNow roles directly to their Service Portal upon login to prevent these users from accessing the main UI. This can be accomplished if the company incorporates a single sign on option or not.

 

 

Redirecting Users without a role

The good news with redirecting users to the portal is that a lot of the work is already done. ServiceNow has an out of the box Script Include that is controlled by a pair of system properties to automatically route users to the (baseline) service portal (/sp). To set this up you simply need to add (1) property to the sys_properties (table) and by default all users that do not have a role will be automatically pushed to the baseline service portal.

To create the new property follow these steps:

  1. type “sys_properties.list” in the filter navigator and press enter
  2. check to see if the “glide.entry.first.page.script” property already exists (if it doesn’t click NEW at the top of the list view)
    1. Name: “glide.entry.first.page.script
    2. Value: “new SPEntryPage().getFirstPageURL()
    3. Click SAVE

At this point, any user that does not have a role assigned to their user profile will be automatically redirected to the baseline service portal.

 

Redirecting Users without specific roles

You might come across a scenario where you want to redirect all users who do not have a specific role to the service portal. This can be easily accomplished by implementing the above mentioned System Property and altering a baseline Script Include called “SPEntryPage“.

To automatically redirect users to the service portal if they do not have a particular role:

  • Go to System Definition/Script Include module and search for the script include called “SPEntryPage“.
  • We will be altering line #69 (it looks like this)

  • by altering the script to include a role such as “itil” it will redirect all users that do not have the “itil” role (or the admin role because admin is included by default) directly to the service portal.
  • your altered script should look like this:

 

Debugging

The script include referenced above has a logging function built in. You can simply set line 21 to true to log information about the user logging in and why they were redirected.

With these strategies, you can make significant strides to improve your Service Portal’s functionality and user management. These methods are a powerful control option in your ServiceNow environment. Remember to use the built-in debugging feature to fine-tune your implementation for a smooth user experience.