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
11-13-2014 07:32 AM
My issue was a little different but I figured out how to fix it. I wanted to allow a role to have access to the 'New' Button on a custom table but the List Control permissions were not working. I couldn't find what I was after in the community either, so I dug into SN and figured it out, here's what I found, I hope it is helpful to someone...
The Global 'New' button UI Action (sys_ui_action) has a function call in it's conditional statement '.canCreate()' this function can be found in Script Includes as 'sc_ic_SectionSecurityManager'. It is only allowing Catalog_* roles to access the new buttons (overriding the List Control settings).
So to fix this find the 'New' button for your table in your UI Action (sys_ui_action) table and remove the '.canCreate()' this will enforce the List Control settings instead of the '.canCreate()' ones.
If you do not find a 'New' Button for your table you will have to create one, follow these steps:
1. go to the sys_ui_action table.
2. Search for Name contains New and Table is Global.
3. Click on the 'New' that has the comment 'Normal Lists'.
4. Right click on the banner and select 'Insert and Stay'.
5. Change the table drop down to the table you need to edit the new button for.
6. Change the action name (I normally just do <first 3 letters of table>_new).
7. remove the '.canCreate()' function from the conditional statement.
Now access to your 'New' button will be controlled by your List Controls.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2014 08:25 AM
this is not really required... if the user has no create access on the table , he will not see the 'New' button .. that is the intention of using canCreate()... if you want to hide the button , add a create ACL for the table and specify who can have access to the 'New' button using 'Require Roles' related list

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2014 11:01 AM
Kalaiarasan,
Your right, all I really needed to do was to go to the table and set a role for the table and then assign that role to the groups I wanted to have access to and they had access to the 'New' button and it work properly.
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2014 09:46 AM
UI Condition: (gs.hasRole("change_request_admin"))
Enter the role you want to limit the view for.
Below is an example of a UI condition I used to limited the 'request approval' button to Change_Admin only.
(current.approval=='not requested' && gs.hasRole("change_request_admin")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2016 10:13 PM
Hello All,
I am working on something similar currently. My requirement is as follow.
I need to hide "New" button on "Incident Task" related list on Incident form. I can't use "List Control" option because I have to hide button based on state of incident. And in List Control we have only option of adding condition based on Roles.
I can use client script. But, I want that to be my last option. Anything else apart from client script which can work, will be really helpful.
Any idea? I am new to service-now.
Thanks in advance.:-)
Vaibhav