Redirect user to a portal page

Shusovit Dutta
Tera Contributor

The requirement is like when a user has the company "xyz" then redirect them to a portal page, and do not allow them to access the backend servicenow. There is no provision of using snc_external role. Need to do it somehow via redirection when particular user loggs in.

2 REPLIES 2

Hugo Gomes
Kilo Guru

You need to modify the "SPEntryPage" script include to do that and define what you need, for example, for my case I needed to redirect the users depending if they had roles and redirect them to the correct portal or backend.

 

 if (user.hasRole('admin')){
            return "/?.do";
		}
        else if ((user.hasRole('sn_customerservice_agent') || user.hasRole('itil')) && !redirectURL && !isServicePortalURL){
            return '/now/nav/ui/classic/params/target/home.do/';
		}
        else if (user.hasRole('sn_customerservice.customer') && !redirectURL && !isServicePortalURL) {
            gs.info('ss user role');
            return '/csm';
        } else if (user.hasRole('sn_customerservice.consumer') && !redirectURL && !isServicePortalURL){
            return '/csp';
		}
        else if (user.hasRoles() && !redirectURL && !isServicePortalURL) {
            return "/?.do";
        } else if (!user.hasRoles() && !redirectURL && !isServicePortalURL) {
            return "/sp";
        }

 

SLK Gupta
Tera Guru

Hi @Shusovit Dutta ,

 

To redirect user to a portal page, you can refer to below links which discuss the same.
https://www.servicenow.com/community/now-platform-forum/redirect-user-to-different-service-portal-ba...
https://www.servicenow.com/community/now-platform-blog/6-ways-to-set-up-your-service-portal-for-redi...

If my response helps you in assisting your requirement anyway, please mark my response as helpful or accepted solution @Shusovit Dutta .

Thanks & Regards,

S. Lakshmikanth Gupta.