- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2022 10:51 PM
I would like to allow a person holding a specific role to access the following View.
(I want to allow role holders to access other people's ess views.)
・Table : sys_user
・View : ess
・Role : u_itsm_counter
I created the following View Rule Script, but it did not work.
I would appreciate anyone's help.
・Script
(function overrideView(view, is_list) {
answer = view;
if (gs.hasRole('u_itsm_counter')) {
answer = "ess";
}
})(view, is_list);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2022 09:37 PM
Finally i found the reason.
If a user selected a view manually.
This selection will be the first priority.
Set the test user's view to "default view" and test it !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2022 10:59 PM
Hi tk37,
Please find below link,
Thanks,
Preethi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2022 11:08 PM
Hi Preethi,
Thank you for your reply.
I have already seen the URL you gave me and if I follow the script example, I think it would be as follows, but this did not work either.
(function overrideView(view, is_list) {
if (!gs.hasRole("u_itsm_counter"))
{return;}
answer = "ess";
})(view, is_list);
Thanks,
tk37
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2022 11:29 PM - edited 12-18-2022 11:35 PM
HI @tk37
have a try with using the glideUser 's hasRole function instead.
var currentUser = gs.getUser();
currentUser.hasRole('u_itsm_counter')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2022 11:47 PM
Hi newhand,
Thank you for your reply.
I followed your advice and modified the following Script, but it does not work.
If there is something wrong with my Script, could you please advise?
(function overrideView(view, is_list) {
var currentUser = gs.getUser();
if(!currentUser.hasRole('u_itsm_counter'))
{return;}
answer = "ess";
})(view, is_list);
Thank you,
tk37