Polymorphic Relationships
Polymorphic Relationships, also known as multi-table lookups, universal lookups, global lookups, or entity-agnostic lookups, allow a single lookup field to reference tables of multiple types. Some system fields exhibit polymorphic behavior, such customer, which can reference either an account or a contact, and regarding on activities, which can reference any entity enabled for activities. As of 2021 Relase Wave 1, MSFT officially released custom polymorphic relationships to general availability.
The Problem
There are still a few UI kinks. First, the maker portal does not offer a way to create or edit them, Second, although their values can be set via code, just as any other relationship, in some cases, the lookup control unexpectedly allows users to interact with only one entity.
The Helpful Bits
How do I Create a Polymorphic Relationship? While you can certainly create and update polymorphic lookups via the API, there is an XRM Toolbox Tool, called the polymorphic lookup manager. Give it a spin.
Why Does Only One Entity Show in My Multi-Table Lookup? If you can’t get the model driven app control to show all of your selected entities, or it suddenly stops working, be aware that currently, if the relationship includes any entities enabled in your app, all of the entities for which it is enabled must also be included in your app. There are a few other requirements. Please see this MSFT support article.
Conclusion
Polymorphic lookups are very powerful. Hopefully the kinks will be worked out soon. Special thanks to Tanguy Touzard for building this invaluable tool and Daryl Labar for helping me pin down this gotcha.
Resources
- MSFT – Multi-Table Lookups:
https://docs.microsoft.com/en-us/powerapps/developer/data-platform/webapi/multitable-lookup - MSCRMTools – Polymorphic Lookup Manager Tool:
https://github.com/MscrmTools/MscrmTools.PolymorphicLookupCreator - MSFT – 2021 Release Wave 1 Plan – Multi-Table Lookups:
https://docs.microsoft.com/en-us/power-platform-release-plan/2021wave1/data-platform/multi-table-lookups - MSFT Support: [Lookup] Records shown for some entities but not others:
https://support.microsoft.com/en-us/topic/-lookup-records-shown-for-some-entities-but-not-others-d0339621-08fb-5cef-a5b9-007a7582306c