Join us Dec. 16 for The Community Hour, our first global virtual User Group event!

Redirect users with roles to Employee slate rather than SP

RenganathanR
Tera Contributor

Hi,

 

Does anybody know a clean way to implement the redirection of users without roles to employee slate rather than SP.

Does modifying the glide.entry.page.script the only way?

 

2 REPLIES 2

Prakash_lakka
Giga Contributor

You can use Single Sign-On (SSO) to handle this redirection seamlessly . It is one of the cleanest enterprise-level methods because it offloads the traffic control logic to your identity provider (IdP) rather than forcing ServiceNow to evaluate scripts post-login.

HasanM
Kilo Sage

Hi @RenganathanR 

Yes, the entry page script is the clean way to do it. Just don't modify SPEntryPage directly; extend it instead.

  1. Create a script include, for example SlateEntryPage:
var SlateEntryPage = Class.create();
SlateEntryPage.prototype = Object.extendsObject(SPEntryPage, {
    getFirstPageURL: function() {
        var navTo = gs.getSession().getProperty('nav_to') || '';
        var isDeepLink = navTo && navTo != 'welcome.do';

        // Users with roles and deep links keep OOTB behaviour
        if (gs.getUser().hasRoles() || isDeepLink)
            return SPEntryPage.prototype.getFirstPageURL.call(this);

        // Roleless users go to Employee Slate
        return '/aiux/employeeworks/home';
    },
    type: 'SlateEntryPage'
});
  1. Set the system property glide.entry.first.page.script (create it if it doesn't exist) to:
    new SlateEntryPage().getFirstPageURL()

Check your Slate URL in the Admin Console before using it. If everyone logs in through SSO, you can set the landing URL in your identity provider instead.

Hope this helps.