How to hide New and Edit button based on roles. Urgent!!!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2014 09:06 PM
Hi All,
I need to hide New and Edit button for problem creator role in the Problem Task related list in Problem form.
I tried all the possible ways but still not working.
PLease help me on this.
Thanks,
Madan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2014 09:47 PM
Madan,
Go through the below link. This will help u out. use
http://wiki.servicenow.com/index.php?title=UI_Actions#Controlling_Visibility_with_Roles
For Example:
Use following script in UI action condtion.
gs.hasRole('itil_incident') || gs.hasRole('itil_problem')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2014 12:11 AM
Hi Mukesh,
I have already tried this but of no use....

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2014 12:19 AM
Hi Madan
Here is your solution http://www.servicenowguru.com/scripting/client-scripts-scripting/removing-form-buttons/
Harish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2014 05:06 AM
Hi Madan,
The simplest way should be to use List Control and add the specific roles that are allowed access. Failing that you could do what Mukesh mentioned and replace the standard UI actions with your own (use the same action name so that the original buttons are over ridden). On your replacement UI actions, modify the visibility conditions to require specific roles (gs.hasRole('itil_incident') || gs.hasRole('itil_problem')) and change the table to Problem (so it doesn't affect any other tables). If this didn't work for you the first time, check the roles on the user you are trying to exclude as they might have additional roles (e.g admin).