Redirect user with a specific role to a specific Service Portal

Ruaa1
Tera Guru

Hello,

 

Is it possible to redirect users with (xyz role + snc_internal) to xyz service portal (not /sp) after logging in?

 

Best regards,

Ruaa

2 ACCEPTED SOLUTIONS

Tuan Vu
Kilo Guru

1. Navigate to Script include -> Search script with the name  "SPEntryPage ".

2. Open the script in detail, Find the function "getFirstPageURL".

3. Add script as image below

TuanVu_0-1669860655914.png

if (user.hasRole('xyz_role') && user.hasRole('snc_internal')) {
return '/your_portal';
}

 

4. Go to sys_properties.list -> create new property

glide.entry.first.page.script
type: string
value: new SPEntryPage().getFirstPageURL(); 

TuanVu_0-1669861002753.png

 

5. login with your test user and check.

Hope this will be helpful for you!

 

View solution in original post

Tuan Vu
Kilo Guru

Admin should not get redirected. so the condition should be updated
if (user.hasRole('xyz_role') && user.hasRole('snc_internal') && !user.hasrole('admin')) {
return '/your_portal';
}

View solution in original post

5 REPLIES 5

Tuan Vu
Kilo Guru

1. Navigate to Script include -> Search script with the name  "SPEntryPage ".

2. Open the script in detail, Find the function "getFirstPageURL".

3. Add script as image below

TuanVu_0-1669860655914.png

if (user.hasRole('xyz_role') && user.hasRole('snc_internal')) {
return '/your_portal';
}

 

4. Go to sys_properties.list -> create new property

glide.entry.first.page.script
type: string
value: new SPEntryPage().getFirstPageURL(); 

TuanVu_0-1669861002753.png

 

5. login with your test user and check.

Hope this will be helpful for you!

 

Tuan Vu
Kilo Guru

Admin should not get redirected. so the condition should be updated
if (user.hasRole('xyz_role') && user.hasRole('snc_internal') && !user.hasrole('admin')) {
return '/your_portal';
}

Hello @Tuan Vu,

 

Yes, that's correct. That's how I implemented it. Thank you very much.

 

Best regards,

Ruaa