Redirecting /sp URL to ESC Portal in ServiceNow

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2025 07:29 AM
In my last project, the client had a requirement to redirect the default Service Portal (/sp) to the new ESC (Employee Service Center) portal.
At first, I explored a lot of options and thought it would be a complex configuration. But I found a simple and effective solution using just a few lines of code.
Here's what I did:
I created a new widget in ServiceNow.
In the Client Script of that widget, I added the following code:
api.controller = function($window) {
$window.location.href = '/esc';
var c = this;
};
I then added this widget to the /sp portal homepage and saved it.
Now, whenever someone hits the /sp URL, it automatically redirects to the ESC portal.
OOTB
simple and effective way using the portal's Theme settings.
1. Go to:
Service Portals > Themes
Open the Theme associated with the Service Portal you want to redirect from (/sp).
2. Under the Theme Record:
Scroll down to the Related Lists and find JS Includes.
Click New to create a new JS Include.
3. Create a New UI Script:
Inside the JS Include, create a new UI Script record.
4. Configure the UI Script:
UI Type: Set to All
Script:
(function () {
window.location.assign("/esc");
})();
Now, when a user opens the /sp Service Portal, they will automatically and almost instantly be redirected to the Employee Center (/esc).
- 602 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2025 07:37 AM
If you are in Yokohama then no code is required:
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2025 03:24 AM
JFYI I have the portal alternation available already in Xanadu, no need to wait for Yokohama...
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2025 06:56 AM
This solution would be nice if the message telling you that portal you just tried to open is deactivated, wasn't appearing EVERY SINGLE TIME, without simple way to deactivate it... (why isn't this message in UX Banner Announcements???). I find the solution with basic JS Include a lot better...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2025 03:31 AM
@Community Alums
is this a question or an information article?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader