How to redirect specific users to a portal upon accessing ServiceNow instance

pascalfrencken
Mega Sage

On our instance we have two groups of users, both of which authenticate via SSO:

  1. Our internal users authenticate via Azure AD and are automatically signed in to ServiceNow
  2. We now plan to add external users who will authenticate via a third-party identity provider (IdP) and then need to be redirected to the Customer Service Management (CSM) portal

For #2 we have the SSO with the third-party IdP working. To redirect these users to the CSM portal, we've added the system property glide.entry.first.page.script and created a script that detects whether the user logged in via the third-party IdP. This script then redirects the browser to the CSM portal.

This works fine upon the first login, but if the user keeps the browser session open and tries to access our ServiceNow instance again, the external logout page is shown instead. Likely because the script in glide.entry.first.page.script is not called since no SSO is taking place, as the user is already logged in.

How can we get external users automatically redirected to the CSM portal, regardless of whether they login the first time or whether they kept their browser open and accessed it a second time?

Regards,
Pascal Frencken
Signify, The Netherland

7 REPLIES 7

Brian Lancaster
Tera Sage

I could not find anything specific to CSM portal so I'm wondering if you follow the same process you would for Service Portal.

https://docs.servicenow.com/bundle/newyork-servicenow-platform/page/build/service-portal/concept/c_S...

@Brian Lancaster That is exactly the construct I used to redirect the external users to the CSM portal using a script referenced in glide.entry.first.page.script .

However, it only seems to work upon the first login. When the external user keeps the browser open, and then clicks on a link to our ServiceNow instance posted elsewhere, the redirect is not taking place. That is the remaining piece of the puzzle I'm trying to solve.

So are you saying that if they get a notification from the case and click on that link it sends them to the standard UI?  If so are the URLs in the notifications set use what it would be if they manually went to the case in the portal?  If your URL are for the standard UI then it will not auto redirect.

Example of the code I have for incident and service portal URL in a mail script.

var url = gs.getProperty('glide.servlet.uri') + 'sp?id=ticket&table=' + current.sys_class_name + '&sys_id=' + current.sys_id;

It's not links in notification emails, it's about links on a third party portal to our ServiceNow instance. Let me explain it in diagrams.

Below is the 'happy flow' where an external user starts off with accessing a partner portal (non-ServiceNow hosted, shown in green) to login (2) and then click a link (3) to ServiceNow. The partner portal acts as IdP in this case. Once in ServiceNow (shown in blue), the user is authenticated (5) and the script is triggered and redirects the user to the CSM portal in ServiceNow:

find_real_file.png

Next is what happens if the user keeps their browser open and goes back to the partner portal (1) to click the link a second time (2). In this case, no authentication is taking place hence the glide.entry.first.page.script (3) is not called and the user ends up on the ServiceNow back-end instead of the CSM portal.

find_real_file.png

I suspect I need to arrange a different redirect for this second scenario, but so far I have not been able to identify how to do this.