In a Model-Driven App, a lookup field is a type of field in a database or application that can be used to reference records from another entity or table. In short, it allows to reference data from another entity or table.
Generally, Lookup fields have a feature which is typically represented by “ + New “ to create a new record for another (related ) table and associate it with current record.
But What If the user creates a new record from the Lookup field for an Entity where the user does not have access to the related table?
So, the best way to restrict the user not to create a New Record from the Lookup Field is Hiding the + New Button as shown in the below image.
Generally, to restrict the user to create a new record can be achieved by 2 ways:
- By removing the create privilege of specific (Target) entity for the security role.
- Hiding + New Button for Lookup fields By Using the XRM TOOLBOX, Modifying the XML from Backend.
1. Removing Create Privilege of Target Entity:
- Open Advanced Settings-> Select Security under System.
- Open Security Roles -> Select & Click on required Security role to modify create access.
- Under Core Records or Custom Entities-> remove the create privilege for specific entity.
- Save and Close.
Hiding + New Button from XRM TOOLBOX through FormXML Editor
- Install the XrmToolBox
- Make connection to the Organisation by providing credentials & select Office 365(Deployment Type).
- After Connection is Validated, go to Tools-> search for FormXmlManager
- Install FormXML Manager Tool
- Connect to the organization & select the Environment
- Click on Load Entities to get all entities List
- Click On the Entity and Select form from the Right side and Edit Form Xml
- Add this below line in the Lookup field Parameters
- Update and Publish the Xml
- Check for the Field in the UI, Successfully, the New Button will be Hidden for lookup field.