I have an object which has a master detail relationship with Account object. I want when creating a new record for this new object from the Account related list, to suggest the current account and not giving the ability to the user to change the record. How can this be applied ? As in the screenshot below, i want the user not to be able to erase this account and select another one. I want it to be the same as in "Edit" action, read only. How can this be achieved?
Solution1 - Change Master detail to Lookup
Just make it readonly for the desired profile from Field level security of the field (You will need to change your master-detail to Lookup)
- Goto the child object,
- Select the Lookup field (e.g. Account) .
- Select the Field level security and then make it read-only for the desired user profile.
Note: The above will work for non System Administrator profiles only, as they have power to unlock readonly fields.
In order to delete the related children, implement a trigger on Account
before delete handler.
Solution2 - Create Custom Component
You can create a VF page or Lightning component that will only have Label/display field that will display the account name and then you can drop on the page layout.