Issue in UI Script Code

Peekaboo1
Tera Contributor

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.

2 REPLIES 2

Max Wittig
Tera Contributor

Login Rules is not an option here?

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?