- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2015 05:24 AM
Hi All,
Based on my requirement ,
I have created a new role "end_user" and it does not have have any "contained role " (which has end user access ) .
If the user has 'end_user' role , after logging it has to redirect to the ess page instead it redirects to navpage.do with enduser modules.
See attached img.
I have modified login rules
1.Users without Roles to ESS :
if(!gs.getUser().hasRoles()&&(gs.getUser().hasRole('end_user')))
gs.setRedirect("/ess");
2.Users with Roles to FrameSet
if(gs.getUser().hasRoles()&& (!gs.getUser().hasRole('end_user')))
answer = true;
But NO RESULT.
Please help me on this .
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2015 11:38 PM
Hi All,
I resoleved by doing the below steps.
1.set false Direct navigation
2.users without roles
if(!gs.getUser().hasRole('admin')||(!gs.getUser().hasRole('itil')))
answer = true;
(content page \ess)
3.users with roles
if(gs.getUser().hasRole('admin')||(gs.getUser().hasRole('itil')))
answer = true;
default UI

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2015
05:35 AM
- last edited on
‎09-17-2023
09:41 PM
by
ServiceNow
Hi Vimal,
You may find the below thread helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2015 11:16 PM
Hi Pradeep,
I have tried on UI scripts .
It's Working fine.
Can you please suggest which is best practice to use among the following?
1. UI Scripts.
2.Installation Exit
Since Login Rule does not works as expected .

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2015 06:32 AM
I think your condition is wrong in the first one. If the user has a role, then !gs.getUser.hasRoles() will always be false.
!gs.getUser().hasRoles() || gs.getUser.hasRole('end_user');
Also, you do the redirect in the gui, so you should take that out of the script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2015 03:42 AM
Hi Brad,
I tried using OR Condition in Login Rule but no use
1. Users without Roles to ESS
Active :false
/*if(gs.getUser().hasRole('end_Support')||(gs.getUser().hasRole('end_user')))
gs.setRedirect("/ess");*/
if(!gs.getUser().hasRole('admin')||(!gs.getUser().hasRole('itil')))
answer = true;
2. Users with Roles to ESS
Active :false
if(gs.getUser().hasRole('admin')||(gs.getUser().hasRole('itil')))
answer = true;
3. Direct Navigation
Active :true
var s = gs.getSession().getProperty('starting_page');
answer = !GlideStringUtil.nil(s);