- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2017 07:25 AM
i have create one view with name " Emergecny" this view should be visible for only ITIL role users only.
for that i have written View Rule script. but it is effecting to admin, it should not be effect to admin persons and other role persons ,
it should effect only to ITIL role users only
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2017 07:44 AM
You can add another check in to not apply for admin roles:
if (!gs.hasRole('admin')) {
if (gs.hasRole('itil')) {
answer = "Emergency"
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2017 07:37 AM
Create the below function and utilize it for checking what all role user has
function hasRoleExactly(role) {
var au = new ArrayUtil();
var roles = gs.getSession().getRoles() + '';
var roleArray = roles.split(",");
var isAuthorized = au.contains(roleArray, role);
return isAuthorized;
}
or may check client side script
GlideUser (g user) - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2017 09:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2017 07:44 AM
You can add another check in to not apply for admin roles:
if (!gs.hasRole('admin')) {
if (gs.hasRole('itil')) {
answer = "Emergency"
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2017 09:10 AM