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
srinu jsrinu j 

how to create one to one relationship between different objects?

Best Answer chosen by srinu j
Ajay K DubediAjay K Dubedi
Hello,
Salesforce allows One to many and Many to many Relationships .You can establish  a one to one relationship by follwing steps
        1. create a master detail relationship between two Object.
    2. On master Object create a  rollup summary field which count the child records
    3. Now write trigger on child Object which checks if the rollup summary count on master is equal to one then throw an error that the master have already one record attached select another.
This way every master Object have one record of the other objec hence one to one relaship is established.
You can follow this link for more detail: http://www.infallibletechie.com/2013/05/how-to-create-one-to-one-relationship.html
 
Thanks 
Ajay K Dubedi.

All Answers

Arunkumar RArunkumar R
Hi Srinu,

You can create the following relationship only in salesforce,

1. One to Many
2. Many to Many

Please find the below link in order to acheive one to one relationship,

http://www.forcetree.com/2009/11/one-to-one-relationship-in-salesforce.html
Jigar.LakhaniJigar.Lakhani
Hello,

Please refer below link. More than options are available.
http://salesforce.stackexchange.com/questions/7282/how-to-create-a-one-to-one-relation-between-two-objects

Thanks & Cheers,
Jigar(pateljb90@gmail.com)
srinu jsrinu j
Thanks for your help
Ajay K DubediAjay K Dubedi
Hello,
Salesforce allows One to many and Many to many Relationships .You can establish  a one to one relationship by follwing steps
        1. create a master detail relationship between two Object.
    2. On master Object create a  rollup summary field which count the child records
    3. Now write trigger on child Object which checks if the rollup summary count on master is equal to one then throw an error that the master have already one record attached select another.
This way every master Object have one record of the other objec hence one to one relaship is established.
You can follow this link for more detail: http://www.infallibletechie.com/2013/05/how-to-create-one-to-one-relationship.html
 
Thanks 
Ajay K Dubedi.
This was selected as the best answer