- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2018 06:41 AM
Hi,
I have only given access to service portal to my users and have not given them itil role but still users after they click on 'back' twice in the service portal are able to reach the backend servicenow.How to stop this?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2018 07:36 AM
You need to delete the script.
If you want it specific for Roles you can use below.
addLoadEvent(ESSUserRedirectSP);
function ESSUserRedirectSP() {
if(g_user.userName != "guest"){
if(!g_user.hasRoles()){ //This works for users with no role
var topurl = getTopWindow().location.toString();
var url = "https://" + window.location.host + "/portal_name";
top.window.location = url;
}
}
}
}
}
Thanks,
Jaspal Singh
Hit Helpful or Correct on the impact of response.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2018 06:49 AM
Try using below UI script snippet
addLoadEvent(ESSUserRedirectSP);
function ESSUserRedirectSP() {
if(g_user.userName != "guest"){
var topurl = getTopWindow().location.toString(); var url = "https://" + window.location.host + "/portal_name"; //replace portal_name
top.window.location = url;
}
}
Thanks,
Jaspal Singh
Hit Helpful or Correct on the impact of response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2018 07:03 AM
Hi,
But due to this script I am not able to access the backend now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2018 07:04 AM
Do you know how can I undo the script?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2018 07:36 AM
You need to delete the script.
If you want it specific for Roles you can use below.
addLoadEvent(ESSUserRedirectSP);
function ESSUserRedirectSP() {
if(g_user.userName != "guest"){
if(!g_user.hasRoles()){ //This works for users with no role
var topurl = getTopWindow().location.toString();
var url = "https://" + window.location.host + "/portal_name";
top.window.location = url;
}
}
}
}
}
Thanks,
Jaspal Singh
Hit Helpful or Correct on the impact of response.