New and Edit UI Action Visibility on Related List
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2023 12:12 AM
Hi All,
For the catalog tasks related list on sc_req_item , I want to show New button based on role, I have created a new role and when I am trying with a user which is non-admin the New button is visible if the user has the specific role and if the user does not have specific role the New button is not visible but if a user is admin the button is visible always even though the admin user does not have that role.
Note : The Omit new button is unchecked and Omit New condition is empty , I am just trying with roles assigned.
Any leads on this would be appreciated.
Please see attached screenshot:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2023 12:22 AM
admin user gets all the roles so you should not test with admin user
Anyhow in production there won't be admin users who will be working on the RITM or SC TASKs
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2023 12:55 AM
Hi ,
Thanks a lot for your reply , so as I understand if the button is made visible admin user would be able to see it if the visibility is controlled through roles (Can you please confirm this).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2023 01:20 AM
with roles you cannot control since admin gets all roles.
The use case of testing with admin user is invalid as no admins will be using the application once it gets into production.
They are just involved in admin activities etc
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2023 12:37 AM
Hello @Anubhav24
You need to add the 'admin' role condition in the UI Action as well, in addition to the list control.
This is the UI action that is invoked for the new button on the catalog tasks related list.
https://xxxxx.service-now.com/nav_to.do?uri=sys_ui_action.do?sys_id=7b37cc370a0a0b34005bd7d7c7255583
You can try the below and see how it works.
- Create a new UI action similar to the one above, but set the table as sc_task.
- Make sure the new one overrides the above OOB UI Action.
- In the new UI action set a condition that current user does not have admin role. Your condition should have this: gs.hasRole('omit_new_button_role') && !gs.hasRole('admin')
Because of this OOB UI action condition, the admin user is able to see the New button.