Redirect user to different service portal based on role or email id domain

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2021 08:44 PM
Hi All,
I have to redirect users to a new/different portal already existing based on their email address domain.
For e.g.
There is an existing Service User portal - Portal1 which doesn't have user specific redirection. We have another portal- Portal2 which is a new portal.
If a user email address is test@abc.com and he tries to login in Portal1 then he should be redirected to Portal2 which is our new portal because his domain is @abc.com else if he is any other user who doesn't have domain of @abc.com he should be redirected to default portal i.e. Portal1 being used.
Regards,
Navneet Arora
- Labels:
-
Service Catalog
-
Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2021 09:10 PM
this article will help you
https://community.servicenow.com/community?id=community_blog&sys_id=cbcda2e9dbd0dbc01dcaf3231f961949

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2021 01:02 AM
This article is for Setting this script up to redirect to multiple portals based on roles/domains is not be covered there
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2021 05:59 AM
that is covered
Setting up a role-based redirection
If you want to be specific with directing certain roles (not just users without any roles) you can modify the SPEntryPage script include to meet your needs. It would be worth your time to also check out kobby.adu-nti's blog on overcoming issues with role redirection with the SPEntryPage
Modifying the SPEntryPage script will set sys_customer_update to true and sys_replace_on_upgrade to false.
In the SPEntryPage script on lines 69-70, you will see where we check for any roles (not specific roles) and whether it's a redirect URL or if the user is trying to access the portal directly.
Here I have commented out these two lines (to keep the original code) and added a specific role(s) check by using hasRole()
This will allow users who have admin (because hasRole automatically passes admin as true) and snc_123 roles to go directly to UI16, all others will be reverted to the Service Portal. Again, this is just an example but provides you with a starting point to configuring your redirection.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2021 09:13 PM
Hello Navneet,
You should play around with the script include: SPEntryPage
Where this is the core logic where it works for the redirection but please do try in your PDI as this is a little crucial to do directly in the instance.
Mark helpful/correct if it helps !!
Regards,
Chalan