Navigate the user to portal / Platform page after login based on their roles

kaukabF
Tera Contributor

Hi

 

Requirement - Navigate the users to portal page "/sp" if they don't have ITIL / Admin roles and if the users have ITIL /Admin roles it should take them to Platform view in my PDI.

To achieve this, I updated the script include "SPEntryPage" Line no 84,85

if (user.hasRoles() && !redirectURL && !isServicePortalURL)
    return;
 
  if ((gs.hasRole('itil')) && !redirectURL && !isServicePortalURL)
            return "/sp/";
 
I used some logs on each function but I can't see any logs after execution. Seems "SPEntryPage" is not triggering.

I've followed the steps outlined in this article - https://pathwayscg.com/service-portal-auto-redirect/ - but the issue persists. I've tried in both our DEV instance and my personal developer instance, same behavior in both.

Am I missing something with this article? Is there any other scripts or alternate ways to achieve this use case? 

 

Thanks in advance!!

1 REPLY 1

Sujatha V M
Kilo Patron
Kilo Patron

@kaukabF Please refer the below support case for reference,

How to setup portal redirection based on different roles

End users (no role) route to "SP portal" and for admin user and other role based users, they should be landing on the native UI.

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0869746

 

Please mark this as helpful and accept it as a solution if this resolves your query.

Thanks,

Sujatha V.M.

Please mark this as helpful and accept it as a solution if this resolves your query.
Sujatha V.M.