Posts

Showing posts with the label one to one relationship in saleforce

Create One to One Relationship in Salesforce

Basically we have two relationships provided by salesforce: 1) One to Many 2) Many to Many (could be achieved using Junction object) But here are few ways to implement scenario to achieve one to one relationship between two objects in salesforce: Way No. 1: Create a lookup field on the child Create a unique field on the child, and hide this field from all page-layouts Write a workflow, for any change of the lookup field, to copy that value from the lookup field into the unique field Way No. 2: create a master detail relationship  create one roll up summary field of count type on master object create validation rule on rollup summary field to check if count >1 so it will give you error if it has more than one record for same master detail relation values. Way No. 3: Create lookup fields on both objects, to each other Write triggers, for any change on these lookups, to either copy the record ID into the other object's lookup field when the other ob...