Understanding Salesforce Object Relationships

There are many skill variations when it comes to Salesforce system implementation and Salesforce integration. One of it requires an understanding on the object relationship within the application. It is not hard to comprehend the relationship once you can identify the data model that you are about to build. The following are some of the common object relationships that are used to define the data model:

1. One to One
2. One to Many/Many to One
3. Many to Many

 

One of the ways to get yourself equipped with the knowledge is to read through the Salesforce Fundamentals documentation. Well, that’s how I got to it while undertaking the Salesforce Certification – Developer. However, if you find that going through the materials a hassle, you can always refer to the following explanation on a quick run-down on how to build the data model.

 

One to One object relationship

Scenario:
One School can only have one Headmaster

 

Implementation:
This object relationship requires that one of the associated object to be unique.
– School (Master object)
– Headmaster (Detail/Child object)
– Create a unique field in Headmaster object
– Create workflow to copy the School id to the unique field for every record creation

 

One to Many/Many to One object relationship

Scenario:
One school can have many teachers

 

Implementation:
– School object
– Teacher object: School field (Lookup to School)

When you view the relationship from School, it’s ONE School to MANY Teachers
When you view the relationship from Teacher, it’s MANY Teachers to ONE School

 

Many to Many object relationship

Scenario:
Student can enrol in many subjects

 

Implementation:
– This is where junction object comes into play for this relationship
– Student Subject (junction object)
– Subject (Master object to Student Subject)
– Student (Master object to Student Subject)

 

This model explains that there are many students taking up many subjects and vice versa.

Hope this clears off any confusion you have with regards to the object relationships.

 

Furthermore, if you plan to perform a Salesforce migration with other applications and require to figure out the object relationship via API, you can simply generate the Salesforce WSDL of your current instance via:

Setup > App Setup > Develop > API > Generate WSDL

 

From there, you should be able to determine the definition of the object relationship. The following extensions explain on the references:

__c – in reference to the custom field id values

__r – in reference to the custom object relationship with the current object view

Get in touch today to see how WDCi can help your business.