How can i hide 'New' button on reference field look up list?

deepthireddy
Kilo Expert

I have a reference field 'Business Initiative' which refers to table 'Business Initiative Lists'. Is there a way i can prevent new table values to be created or existing values to be edited or deleted via this field. In short, i need to hide 'New' button on the look-up. Help please?

find_real_file.png

1 ACCEPTED SOLUTION

Abhinay Erra
Giga Sage

Hi deepthireddy


Go to UI actions and search for global table and comments is Normal list and add this condition in UI action.



&& !(RP.getParameterValue('sysparm_view')=='sys_ref_list' && RP.getParameterValue('sys_target')=='u_business_initiative_list')


1.PNG


2.PNG


View solution in original post

28 REPLIES 28

Hi Ankur,



Yes I've created an ACL. Let me explain what's happening:



When i try to hide the 'new' button using List control or create an ACL for that referenced table, the "New" button is hidden everywhere. WHat i need is that users cannot create a New value of the table via the new Business Initiatives field. How can i achieve it only at field level?


Hi Deepthi,



There is no way you can restrict it at field level. Maybe you can try to have before insert Business rule that checks whether the insert is from a valid user. If not then


abort the transaction.


current.setAbortAction(true);



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

tya
Kilo Contributor

Hi Deepti,



Just create an ACL   with create operation on your referenced table ie, 'Business Initiative Lists' and in role field give admin ie,only a person having admin role can create. In this way he can only see new on that table no other user can see.


Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Shikha


Abhinay Erra
Giga Sage

Hi deepthireddy



Prior to Helsinki you need to add a condition to the New global UI action button to hide the button form the ref_list views. But in Helsinki you need to add the same condition to the UI cation, but this time you will still see the button on the list but when you click on it you will get a "Action not authorized" message on the form. Let me know the table name on which you want to this to happen, I will provide you the conditions you need to add to the UI action.


Hi Abhinay,



This will be very helpful since many of us do not know how to achieve this at field level.


The table name is 'u_business_initiative_list'



Thanks much.