Contents
- 1 What is an example of polymorphic field in Salesforce?
- 2 What is polymorphic lookup in Salesforce?
- 3 What does the word polymorphic mean?
- 4 How are foreign keys used in a polymorphic relationship?
- 5 Why do we need polymorphic lookups in Dataverse?
- 6 How to use polymorphic relationships in soql queries?
What is an example of polymorphic field in Salesforce?
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.
What is polymorphic lookup in Salesforce?
Salesforce makes use of polymorphic relationship fields for native lookup fields that can reference multiple objects. The most common fields that use polymorphic relationships are Owner fields and Activity WhatId/WhoId fields.
What does the word polymorphic mean?
Polymorphism, in biology, a discontinuous genetic variation resulting in the occurrence of several different forms or types of individuals among the members of a single species. A discontinuous genetic variation divides the individuals of a population into two or more sharply distinct forms.
What is polymorphic lookup?
Polymorphic lookups. Show the columns of a record owner. Filter based on an owner. Update the owner by using Patch. Show the owner by using a form.
How are relationship fields used in a polymorphic relationship?
In a polymorphic relationship, the referenced object of the relationship can be one of several different types of object. Some fields are relationship fields, which means they can be used to get information about a related object. And some of those relationship fields are polymorphic fields.
How are foreign keys used in a polymorphic relationship?
Polymorphic relationships work by using a lookup table with an additional column specifying which table the foreign key should reference. In non-polymorphic relationships, the foreign keys references a primary ID in a specific table. On the other hand, a foreign key in a polymorphic lookup table can reference many tables.
Why do we need polymorphic lookups in Dataverse?
That last detail is important because you always know what fields will be available for the lookup. Dataverse also supports polymorphic lookups, which can refer to a record from any entity in a set. For example, the Owner field can refer to a record in the Users entity or the Teams entity.
How to use polymorphic relationships in soql queries?
For example, the Who relationship field of a Task can be a Contact or a Lead. The following describes how to use SOQL queries with polymorphic relationships in Apex.