Salesforce Relationships - El Toro - Find articles about Visualforce, Apex, Force.com and Salesforce in general

Print Preview

Salesforce Relationships

Salesforce has always have Lookup and Master-Detail relationships, but with the introduction of Lightning Connect (which allows you to access external data via oData from within Salesforce) it created two more types of relationships Indirect and External. This chart can help you clarify the differences between these relationships. 

Lookup Relationship​: With the introduction of Lighning Connect you can now create a lookup relationship from an external object (connected via oData) to any standard or custom object. They use the standard 15/18 character IDs to link both records and the record access security between the parent and child is independent.

Master-Detail Relationship​: This had no change with the introduction of Lighning Connect. You are still able to make a relationship from a custom object to either an standard or custom object. With this type of relationship the record access security is controlled at the parent (they have independent CRUD and FLS), this type of relationship allows you to create RollUp Summary Fields. I guess that because of these two reasons, you can't use this master-detail relationships with the external objects connected via oData.

  • Salesforce does not import the data, it just queries it qhen requested by the users, so it would be hard to know when the records change and therefore there could not do a RollUp Summary on the details. Also, as of Summer '15 Lightning Connect is read-only, so the summary values could not be pushed via the oData
  • oData controls it's own security which is independent of Salesforce, so the security could not be handled via Master-Detail relationships.
External Lookup Relationship: In this case, the child can be any standard, custom or external object and the parent can only be external objects, because when Lightning Connect creates the external object, a standard field called ExternalID is created to hold the record primary key field as defined in the oData database. This is the field that will be used to link both records. The child object must define a custom text field to store the foreign key text field.

Indirect Lookup Relationship: In this last case, the child can only be an external object and the parent can be either an standard or a custom object, but it must have a text field that is marked as both Unique and External ID. 

comments powered by Disqus

© El Toro . IT @ 2013
Andrés Pérez