Assistance Required with Portal Routing Logic Based on User Company
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2024 05:47 AM
Hi Expert
I have a requirement related to portal routing that I need some help with. Here's the scenario:
- If a user belongs to company "ABC," they should be routed to the Service Portal (SP).
- If a user belongs to company "XYZ," they should be routed to the Customer Service Management portal (CSM).
- After logging out, the user should be redirected to the common login page (SP landing page).
I’ve created a new Script Include that inherits the SPEntryPage Script Include. In the initialize function, I added the following code:
When I impersonate a user from company "XYZ," the CSM portal is displayed as expected. However, when I log in using my credentials (from company "XYZ"), it always redirects me to the Service Portal (SP) instead of the CSM portal.
Could you please assist me in resolving this? I suspect there may be an issue with how the user's company is being checked or how the logic is being applied during login.
Looking forward to your guidance on this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2024 06:52 AM
I'll apply this to multiple companies

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2024 06:57 AM
How much does this solution need to scale?
ServiceNow has the Custom URL plugin that allows you to direct users to portal based on the vanity URL used.
Similar to how SSO works, have you considered adding a reference field to the core_company table to the sp_portal table. That way in your script you can simply dot-walk that field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2024 07:17 AM
No, I didn't add any reference field, Can you please help me what change i should make