Employee Center Portal customization based on user roles
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2025 09:18 PM
Is it possible to customize the employee center homepage based on the roles they have, like, if user has no role it should redirect to different homepage and for approver roles should have different widgets on homepage
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2025 09:25 PM
Yes, You can make widgets role based visible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2025 09:26 PM
Yes, in ServiceNow, you can customize the Employee Center homepage based on user roles by using User Criteria to control widget visibility and sp_redirect or script includes for role-based redirection. Use g_user.hasRole('role_name') for conditional logic and assign specific portals or homepages for different roles in Portal Configuration.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2025 09:30 PM
Yes, you can customize the Employee Center homepage based on user roles in ServiceNow. Use role-based redirection and widget visibility configurations to achieve this. For users without roles, create a rule to redirect them to a specific homepage. For users with roles like "approver," configure widget visibility or set up role-based homepages using Experience Builder.
Here is an example of how you can implement it in script:
Server Script to Check Role:
var RoleBasedRedirect = Class.create();
RoleBasedRedirect.prototype = {
initialize: function() {},
hasNoRoles: function() {
return !gs.hasRoles();
},
type: 'RoleBasedRedirect'
};
Client Script to Redirect:
api.controller = function ($scope, $window, spUtil) {
$scope.handleUserRoles = function () {
if (!g_user.hasRoles()) {
$window.location.href = "/no-role-homepage";
} else if (g_user.hasRole('xyz')) {
spUtil.addInfoMessage('Welcome!');
}
};
$scope.handleUserRoles();
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2025 09:34 PM
Hi @SNDP,
Please have a look on this KB article - How to setup portal redirection based on different roles
Please mark my response as correct and helpful if it helped solved your question.
Thanks,
Rohit Suryawanshi