I have a MD relation between two custom objects. So, the scenario is, right now I am able to create many child records (i.e. 1:M relation), but I have to restrict it to only one record creation (i.e. 1:1 relation) without changing the schema. Please help
1 Answer
As you are already using a master detail relationship. So here is one easy solution for you.
Create one Roll up summary field and do count of child record and add validation that count should not be greater then 1.
You don't need any apex code for this and if in future you want to change the limit just update the validation rule and if needed can deactivate that.