Redirecting users with a specific role from one portal to another

vidhya_mouli
Giga Sage

We want users with sn_customerservice.customer role to be automatically redirected to business_portal. This is done through SPEntryPage and works as expected. The issue with, when the user types /esc in the URL, it takes them to 404 page. Instead, I want them to be redirected to business_portal again. How to do this?

 

Any suggestions are much appreciated. Thank you.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@vidhya_mouli 

to handle 404 with direct url opening do this

-> in esc portal find the 404 page field

-> create a custom portal page that contains the redirection script

-> then give this portal page in 404 field on esc portal

-> create a simple widget and add this widget in that new portal page

-> widget will just have this in client controller

// In the client controller or JavaScript widget
window.location = '/business_portal';

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@vidhya_mouli 

to handle 404 with direct url opening do this

-> in esc portal find the 404 page field

-> create a custom portal page that contains the redirection script

-> then give this portal page in 404 field on esc portal

-> create a simple widget and add this widget in that new portal page

-> widget will just have this in client controller

// In the client controller or JavaScript widget
window.location = '/business_portal';

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

vidhya_mouli
Giga Sage

@Ankur Bawiskar Yes it worked thank you. I just added one more line to the code so that the admins will not get redirected.