Roles and UI Action visibility
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2015 02:47 PM
Hello,
I have created a group of 4 members(all are admins), out of which i have given an extra role "MANAGER" to one member in the group.
I have created a form button called "SEND" in the change form using UI action.
My requirement is that "SEND" button should only be visible to the user with extra role "MANAGER".
SO, In the condition field of UI action, I have written gs.hasRole("MANAGER"). But the button is visible to all the users in the group.Please help
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2015 03:24 PM
Yes i have written the same case. But didnot work:(
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2015 03:30 PM
Mmm..! Would you mind sharing a screenshot of your UI action?
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2015 03:49 PM
Hi Sai, can you make your UI Action a client based UI Action?
hasRoleExactly belongs to g_user. Soo... your UI Action will need to be 'Client' based and your condition will be the following...
g_user.hasRoleExactly('Manager');
Thanks,
Berny
Post edited: Thanks to Edwin Munoz who poited out that hasRoleExactly belongs to g_user and not to g_form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2015 09:57 PM
Hello Berny,
I think it is a method for the glide user object if I'm not mistaken:
http://wiki.servicenow.com/index.php?title=GlideUser_%28g_user%29#gsc.tab=0
I would recommend to create a script include and then call it in the condition. On the sricpt include query the sys_user_has_role table and return true if the current user has the role or false if it doesn't have the role.