function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MalakondaiahMalakondaiah 

Can i make master detail field is readonly or hidden in edit page?

Hi,

Can i make master detail field is readonly or hidden in edit page not for the detail page?
Best Answer chosen by Malakondaiah
Akshay_DhimanAkshay_Dhiman
Hi Malakondaiah,

It is not possible to hide the Master field on the Page layout because it’s a required field in a master detail relationship .
But there is an option called "allow reparenting" at field setup of the master-detail custom field on the child object.
If it is unchecked, once the child record is created, it can't be edited and you can make it read only.

Please follow the below images:

User-added image


User-added image

Please mark my answer as a solution if it is helpful.
Regards,
Akshay

All Answers

Akshay_DhimanAkshay_Dhiman
Hi Malakondaiah,

It is not possible to hide the Master field on the Page layout because it’s a required field in a master detail relationship .
But there is an option called "allow reparenting" at field setup of the master-detail custom field on the child object.
If it is unchecked, once the child record is created, it can't be edited and you can make it read only.

Please follow the below images:

User-added image


User-added image

Please mark my answer as a solution if it is helpful.
Regards,
Akshay
This was selected as the best answer
MalakondaiahMalakondaiah
Hi Akshay,

That was ok.

 My requirement :
Can i make master detail relationship field is readonly or hidden in edit page of master object not for the detail page of child object?

opportunity should be readonly or hidden in edit page opportunity.

.User-added image


 
Akshay_DhimanAkshay_Dhiman
Hi Malakondaiah,
Thanks for selecting my answer as a best answer.
When there is master detail relationship, it will automatically make mandatory field in master object and you can't Hide or Read Only this is mandatory field in edit page.

Regards,
Akshay