
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2022 10:57 AM
Hi Folks,
We've adopted the Employee Portal as out default portal, both for HR and IT users; however, we still have some users manually going to the old /sp service portal page - likely via bookmark, and we'd like to redirect them to the Employee Portal.
Has anyone else accomplished this?
Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2022 07:17 PM
Hi Jon,
Yep, I had to redirect from 3 different portals to the new Employee Center. Basically, you'll add redirects from each portals theme via a JS include.
Good luck!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2024 02:58 AM
One of my customers needed to temporarily redirect non-admin users from Employee Center to their Service Portal until implementation of Employee Center was complete. Solving this problem required some experimentation since documentation and solutions were lacking.
First I added a UI Script [sys_ui_script] related to the EC Theme (used by the Employee Center portal). The UI Script table is accessible via All > System UI > UI Scripts, then creating a new record. UI Type = Mobile / Service Portal.
The UI Script record needed to be mapped to the Employee Center portal [sp_portal] and its related EC Theme [sp_theme]. This is accomplished by creating a JS Include [sp_js_include] record that references the UI Script, then creating a record on the JS Includes many-to-many table [m2m_sp_theme_js_include] that maps the new JS Include to the EC Theme.
JS Include:
JS Includes M2M record (maps the UI Script / JS Include to the EC theme):
With these mapping records in place and the new UI Script now related to the Employee Center portal, I was able to experiment with the client code and discover what information was contained in the global client objects. It turned out that 'this' was able to actually provide me with what I needed (whether the user has the admin role).
First I used alerts to print out the keys of the client object:
var c = this;
var keys = Object.keys(c);
alert(keys);
Among the dozens of object keys printed out in the alert, I found the variable
g_user_is_admin.
To determine whether this variable indeed stored a valid value for whether the current user is admin or not, I again used an alert to display the variable value:
alert(g_user_is_admin);
Impersonating a non-admin user and visiting <instance URL>/esc displayed the string "false". Viewing the same page as admin displayed the string "true".
Using this information I was able to redirect non-admin users to /sp by rewriting the UI script as
// Check if the current page's pathname starts with '/esc'
if (window.location.pathname.startsWith('/esc')) {
// Check if the user is not an admin
if (!g_user_is_admin) {
// Redirect non-admin users to '/sp'
window.location.href = '/sp';
}
// If the user is an admin, no action is taken, and they continue to '/esc'
}
This UI Script successfully allows an admin to proceed to Employee Center and redirects all others to Service Portal. When the customer was ready to make Employee Center available to their users, I simply deactivated the UI Script.