Search code examples
salesforcedata-warehousepolymorphic-associationsdata-vaultpolymorphic-relationship

Modeling the Salesforce Polymorphic relationship in Data Vault 2.0 methodology


Occasionally Salesforce Object have polymorphic relationships with other Salesforce Objects. In a polymorphic relationship, the referenced object of the relationship can be one of several different types of object. These polymorphic relationships are defined using polymorphic fields contained in a Salesforce Object. A polymorphic field is one where the related object might be one of several different types of objects. For example, the Who relationship field of a Task can be a Contact or a Lead. Similarly the What relationship field of a Task can be any non-Person Object in Salesforce.

What is the best way to model these Salesforce polymorphic relationship in the Data Vault methodology?


Solution

  • we also use Salesforce at Scalefree internally and turn this into a Data Vault 2.0 model. In a data-driven Data Vault 2.0 model (that is what we teach and preach) you have two choices - either you consider the Who -related object as a generalized object. That would require a generalized hub, which is later linked (in the Business Vault ) to the Contact or Lead hub (in the Raw Data Vault) by using business logic (that is why the link belongs into the Business Vault).

    The other option is to store the Salesforce ID (the char(18)) into a satellite and just ignore that this is a relationship - at least in the Raw Data Vault. In the Business Vault you calculate the links between task and contact or lead based on the satellite data and with business logic (how to distinguish leads from contacts essentially, which is simple).

    Hope that helps, Michael Olschimke