Issue in UI Script Code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2025 08:35 AM
if ( document.URL.indexOf('.do') != -1 ) {
window.location = '/esc';
}
This UI Script code doesn't work if it's related to pa dashboard like $pa_dashboard.do / $pa_dashboards_overview.do (for the users who doesn't have any roles, it doesn't get redirected to the /esc page). But it works fine if the URL is
https://instance.service-now.com/incident.do -> gets redirected to esc
https://instance.service-now.com/$pa_dashboards_overview.do -> doesn't get redirected to esc rather stays on the backend page and either shows you are not allowed to view / show the dashboards.
So, I added this extra condition:
if ( document.URL.indexOf('.do') != -1 || (document.URL.indexOf('$pa_dashboard.do') != -1 ) || (document.URL.indexOf('$pa_dashboards_overview.do') != -1 )){
window.location = '/esc';
}
Still the above piece of code doesn't work.
Please help on this if anyone has faced and fixed similar kind of issues. I would truly appreciate the help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2025 08:39 AM
Login Rules is not an option here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2025 08:56 AM
Client follows the UI script mechanism...is there any way to achieve it using UI script?
In case we need to apply login rules, can you please let me know how to apply that?