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
Shree KShree K 

How to make one child record to be linked with only one master record when having master-detail relationship?

kevin lamkevin lam
A child record can't be linked to more than one master record in a master-detail relationship.
Shree KShree K
sorry kevin,looks like i didn't put my question in the way that it has to be,
Usually if we have master records M1and M2 on master object similarly child records C1 and C2on detail object,both reords C1 and C2 can select the either M1 or M2 record as their master record (through master detail lookup field).

but my requirement is,if M1 is selected as master by C1 record then C2 should not be able to select M1 as its master record,atleast there should be some error message for eg "you can't select this record as master because it has been linked to another record" 
kevin lamkevin lam
So your requirement is every master can have one child only. If that's the case, then you can create a rollup summary field on the master to store the number of child records, then create a validation rule to restrict its value to not greater than one.