Restrict views based on role.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2020 01:33 AM
I had a requirement, based on roles the for views should be restricted. My requirement is if a user as 'itil' role, then he only 'additional info' view should be visible. Check below image.
I tried creating view rules with below code. But its not working. Please your inputs are appreciated.
(function overrideView(view, is_list) {
// Add your code here
if(gs.hasRole('itil')){
answer='additional_info';
}
else
answer = null; // set the new view to answer
})(view, is_list);
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2020 01:42 AM
Hi Divya,
please follow these links it might help you :
https://community.servicenow.com/community?id=community_question&sys_id=49314be5db98dbc01dcaf3231f961944
https://community.servicenow.com/community?id=community_question&sys_id=5f10d3e5dbdcdbc01dcaf3231f9619d7
Hope this helps !
Regards
Apeksha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2020 02:57 AM
I tried but its not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2020 03:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2020 06:37 AM
This is also not working. No luck!!!!!