Skip to main content

Relationship In Salesforce

Relationship In Salesforce
1. Master-detail relationship
2. Lookup relationship
3. Self-relationship
4. External lookup relationship
5. Indirect lookup relationship
6. Many-to-many relationship (junction object)
7. Hierarchical relationship

Master-detail relationship

It is a strongly coupled relationship among Salesforce objects, which means if a master record gets deleted, then the child records associated with it are also deleted.
In this type of relationship, the parent record controls the behavior of the child record regarding visibility and sharing. It means the security setting of a parent object applies to the child object.
When there is a master-detail relationship between two objects, you can create a unique type of field over the master object, called Roll-up summary. A roll-up summary field allows us to calculate values from child records, such as the number of child records linked to a parent record.

Lookup relationship

It is a loosely coupled relationship among Salesforce objects, which means even if a parent record gets deleted, the child records remain in the system.
Here, both the parent and child have their own sharing settings and security controls. 


Self-relationship is another example of a lookup relationship. In Salesforce, we can use lookup relationships to create self-relationship among objects; we can have a maximum of 40 self-lookups. For example, a campaign record can have a Parent Campaign record.

External lookup relationship

We can create two special lookups on an external object apart from the standard lookup relationship. They are external lookup relationship and indirect lookup relationship.

External lookup relationship allows us to link an external object to a parent external object whose data is stored in an external data source. In other words, it allows us to link two external objects.

Indirect lookup relationship

An indirect lookup relationship allows us to link an external object to a standard or custom object.
We can only create an indirect lookup to an object with a unique external ID field on the parent object that is used to match the records in this relationship.
While creating an indirect lookup relationship field on an external object, we have to specify the child object field and the parent object field to match and associate records in the relationship.
For example, we can display a related list of payments from the ERP external record with matching external IDs on the account object.

Many-to-many relationship (junction object)

§The many-to-many relationship in Salesforce allows us to link a child record to multiple parents.
If you have two objects, called Case and Article, and you want to relate these two objects in such a manner that one case can have multiple articles and one article is linked to many cases, then we have to use the many-to-many relationship. The many-to-many relationship is made with the help of a junction object. In this case, we can create the third object, let's say, Solution with two master-detail relationships with Solution - Case and Solution - Article.

Hierarchical relationship

In Salesforce, only a user object has this type of relationship where we can create a hierarchy of users in the organization. For example, a user can have his manager, and his manager may have senior manager, and so on till the CEO or CIO level.


Popular posts from this blog

Platform Developer I Certification Maintenance (Winter '23)

 Maintain Your Platform Developer I Certification for Winter ’23 1. Field update actions have changed in API Version 54.0. Which record-triggered flows do field update actions now execute? Answer: Before-Save after After-Save 2. Which Apex class is used to determine the hostnames for the domains that Salesforce hosts for your org? Answer: System.DomainCreator 3. Which modules can be used for notifications in a Lightning web component instead of native APIs? Answer: LightningAlert, LightningConfirm, and LightningPrompt 4. What determines an org’s “shape” in Salesforce? Answer: Features, settings, edition, limits, and licenses 5. Which lightning-modal-* component is required to create a modal? Answer: Body 6. How do you call an invocable action from Apex code? Answer: Reference Invocable.Action Get Hands-On With Apex Assertions 1. Create Two Apex class: Copy and Paste below codes (A.) TestFactory @isTest public class TestFactory {    public static Account getAccount(String accountName, B

Custom Table In LWC

I'm assuming you've Basic understanding of Lightning Web Component, I'll be explaining you the syntax that will be generic. HTML: < template > <!-- Header Part -->      < lightning-card   title = "Custom Data table in Lightning Web Components" >          < div   class = "slds-grid slds-gutters" >              < div   class = "slds-col" >                  < span ></ span >              </ div >              < div   class = "slds-col" >                  < span > <!--A Button For extra feature-->                      < lightning-button   label = "Show Selected Contacts"   onclick = {showContacts}   style = "margin-left: 40%"   variant = "brand" > </ lightning-button >                  </ span >              </ div >          </ div >< br />

LWC js-meta.xml Configuration File Tags

Each Lightning web component folder must include a configuration file named <componentName>.js-meta.xml. The configuration file defines the metadata values for the component, including the design configuration for the Lightning App Builder and Community Builder. Some Standard Key metadata values: apiVersion : A double value that binds the component to a Salesforce API version. isExposed : If isExposed is false, the component is not exposed to Lightning App Builder or Community Builder. To allow the component to be used in Lightning App Builder or Community Builder, set isExposed to true and define at least one <target>, which is a type of Lightning page. Some Standard Optional metadata values: description : A short description of the component, usually a single sentence. masterLabel : The title of the component. Appears in list views, like the list of Lightning Components in Setup, and in the Lightning App Builder and in Community Builder. targets : Specifies wher