Redirecting /sp URL to ESC Portal in ServiceNow

Community Alums
Not applicable

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:

  1. I created a new widget in ServiceNow.

  2. In the Client Script of that widget, I added the following code:

api.controller = function($window) {
  $window.location.href = '/esc';
  var c = this;
};

 

  1. 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).

4 REPLIES 4

Dr Atul G- LNG
Tera Patron
Tera Patron

If you are in Yokohama then no code is required:

 

DrAtulGLNG_0-1748529430828.png

 

*************************************************************************************************************
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]

****************************************************************************************************************

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! */


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...

Ankur Bawiskar
Tera Patron
Tera Patron

@Community Alums 

is this a question or an information article?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader