Skip to main content

Hi all,

 

I hope you are all doing well!

 

I have a question regarding Salesforce diagrams and data modeling. I was recently introduced to the concept of Subtype and Supertype entities. Can anyone explain what they are and how they work? I understand that these concepts differ from record types, as it seems you cannot create a record type within another record type.

 

Specifically, how can you model subtype and supertype relationships in Salesforce? 

 

What are the best practices or methods to represent this kind of hierarchical relationship?

 

Thanks in advance for your help!

5 件の回答
  1. 2024年8月3日 16:52

    Types are handled differently than hierarchy (though they are often related).

     

    Given the Account example in the Architect's link Brian provided, you have 4 subtypes of Account. By using Record Types, think of it being in the same Database Table with the ability to show different columns. (the underlying table still has all columns, but some may be empty).  A Business Account record may have different fields displayed (and therefore populated) than a Consumer Account. 

     

    With record types alone, there is nothing that suggests any forced hierarchy of types.

     

    Now for Hierarchies, that's where Lookups can come into play, and you can leverage field visibility of one record type to only show Lookups of "child" record types.

     

    Using that same example, you could have:

    1. Top level is Business Account, 
      1. Related List that has only Consumer Accounts
    2. 2nd level is Consumer Account (not really real-world, but work with me here)
      1. Lookup to Account (filtered to Business only)
      2. First Related List that has only Billing Accounts
      3. Second Related List that has only Service Accounts
    3. 3rd level of Billing Account
      1. Lookup to Account (filtered to Consumer only - again, not really real-world)

    What you will have to work through, is if your hierarchy of Types really should be represented in the same Salesforce Object, or if they should be their own Objects.

     

    Another thing to consider, depending on what you are modeling, your nested subtype could be a simple Dropdown/Picklist.

0/9000