- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2017 08:13 AM
Hi,
Here is a SPEntryPage Script Include snippet:
if (user.hasRoles() && user.getFullName() != "System Administrator" && user.hasRole('x_11111_notes.service portal')){
//
} else if (user.hasRoles() && !redirectURL && !isServicePortalURL)
return;
and I would like to redirect users with role "x_11111_notes.service portal" to Service Portal homepage.
Looks like 1st IF condition doesn't work 'cause I created user with admin roles in system table Users - it also redirects to Service Portal Page. It's just because of newly create admin user is also has 'x_11111_notes.service portal'.
Can anyone advice where I am wrong? Is there any workaround?
Thanks.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2017 06:58 PM
an admin user will always return true for gs.hasRole(...) no matter what role you pass in there. So for your first if condition to work and to exclude admins, you need something like this:
- if (gs.hasRoles() && !gs.hasRole('admin') && gs.hasRole('x_11111_notes.service portal')) {
I put gs here instead of "user" but I don't know what you have set user variable to, so that may be fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2020 02:02 AM
I have 4 service portals and 4 users group and want to redirect them as per their group name or role. Please advise
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2024 02:31 AM
Hey Jon,
Suppose I want to redirect some user who has only one perticular role to service portal, but if they have additional role along with that then they will be able to see classic view. What I need to do
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2017 02:43 AM
Will this be applicable if i have to redirect users to different portals based on groups membership or roles?? Please comment