- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2023 10:30 PM - edited 07-27-2023 10:31 PM
Dear Experts,
My requirement is if the user has MX_PORTAL role then he should be redirected to "sp_blau" and if not then "sp"
So I did changes in the SP Entry page scriptRedirection is working fine, but when the user manually changes the URL to https://devXXXX.service-now.com/sp then he is able to see the sp portal which I do not want.
I also wrote this UI Script and added it to JS to include it on the theme record of the/sp portal but in the console I am getting this error "Uncaught Reference Error: addLoadEvent is not defined"Here is my ui script
addLoadEvent(redirect); function redirect() { if(g_user.hasRoleExactly("MX_PORTAL") && document.URL.indexOf('sp_blau')== -1){ window.location='/sp_blau'; } else {return;} }
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2023 01:31 AM
To help everyone
Steps :
1. create a UI script and from that ui script call script include via glideAjax,
2. then based on the response from that script include you can redirect.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2023 10:58 PM
check the below blog
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2023 01:31 AM
To help everyone
Steps :
1. create a UI script and from that ui script call script include via glideAjax,
2. then based on the response from that script include you can redirect.