
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2020 05:40 AM
Hi everyone,
In the Asset table, i have a location field (reference type) and once we clicks that field, it shows locations and there is a New button also. I want to restrict that New button to only 2 users. When i go and check in the UI actions, there are 5 New buttons on Global table. So where and how i have to write the code to get requirement done.
Please help
Regards,
Indup
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2020 05:45 AM
When the location list is visible (where it shows the New button), click on a column menu and click on 'Configure>List Control'. You can give the two users a specific role and then add that role to the 'New Roles' selection.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2020 05:50 AM
Hi Indup,
If you right click on the new button on the bottom of the form, you'll get a link that will let you edit the action. That will let you determine if are using a common action or one specific to your form. You can always clone to get specific.
Once you know what action you are using, you can add a condition to limit visibility. Best practice is to have a group for those who can see the new button. That lets you simplify your condition to something like this:
gs.getUser().isMemberOf("<your group name>")
If the new button is showing up on a related list, you manage visibility via a list control. Right click on a column heading in the related list to get to those.
Hope that helps.
:{)
Helpful and Correct tags are appreciated and help others to find information faster
:{)
Helpful and Correct tags are appreciated and help others to find information faster

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2020 06:09 AM
HI Anup
Click on Refrence Qualifer icon.which will open a pop up of location table
Click on Coloumn name ->Configure ->list control
And in the Omit new condition :
if((gs.hasRole('mention_name of user role to which you don't want to show new button')
{
answer=true;//to omit(hide) new button
}
I tried it on my personal instance
Please mark my answer correct/helpful if it ease your work.
Regards
Yash Agrawal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2020 07:23 AM
Hi,
no need to create any roles; you can use this approach
1) go to New Button present on Global Table
Link: https://instanceName.service-now.com/nav_to.do?uri=sys_ui_action.do?sys_id=80c8c3a60a0a0b34003364513f7d9d27
2) change the table to cmn_location table and add this in condition so that it is shown to only those 2 users
then do insert and stay
gs.getUserID() == 'user1_sys_id1' || gs.getUserID() == 'user2_sys_id2'
Scalable Approach: Creating groups is not an issue;
Going in future if the number of users increases to whom it needs to be shown then you can create group and add those users to the group and use this in condition
gs.getUser().isMemberOf('GroupA');
this solution is scalable; just add users to group to show the New button; just remove user from group to hide the New button
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader