Roles and UI Action visibility

Sai Santhosh Ch
Tera Contributor

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

8 REPLIES 8

Yes i have written the same case. But didnot work:(


Mmm..! Would you mind sharing a screenshot of your UI action?



Thanks,


Berny


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.


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.