Controlling ServiceNow traffic by redirecting users to your Service Portal

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:

 

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.