How to create a one-to-one relation between two objects?

Currently I do the following to create a one-to-one relation between two objects:

  1. Create a lookup field on the child
  2. Create a unique field on the child, and hide this field from all page-layouts
  3. Write a workflow, for any change of the lookup field, to copy that value from the lookup field into the unique field

This process has many overheads:

  1. Extra field is required
  2. Unique criteria is utilized (we only get 3 unique fields per object)
  3. Workflow is used

What other ways are there to create a one-to-one relation between two objects?

Answer

another way to do is…
create a master detail relationship and than on master create a roll up summary field of child with count. then you write validation on rule rollup summary field to check for >1 .. so it will give you error if it has more than one record for same master detail relation values..

one to one created…

Attribution
Source : Link , Question Author : Shumon Saha , Answer Author : shashi Lad

Leave a Comment