In the dynamic realm of client-focused solutions, the strategic use of 'lookup' fields capable of storing references to multiple entities can significantly enhance adaptability. This article delves into the concept of polymorphic lookups in Dynamics 365, exploring real-world scenarios where this feature proves exceptionally valuable.

Polymorphic Lookups in Dynamics 365

Polymorphic lookups, a feature allowing links to various entity types based on specific criteria, are integral to Dynamics 365. For instance, the 'Regarding Object' field in the 'Activity' table extends its reach to entities like 'Email,' 'Task,' and more. However, while the existing data type 'Customer' accommodates references to both companies and contacts, specific scenarios may necessitate more tailored solutions.
An advantage of polymorphic lookups is their integration into Dynamics 365's standard tools. In the screenshot below, users can select the entity from which they require data, including options like 'Firmen,' 'Kontakte,' 'Aufgaben,' 'EntitySample1,' and 'EntitySample2.'

Implementing Polymorphic Lookup Functionality

While this type of lookup isn't entirely 'official' at present, tools like the 'Polymorphic Lookup Manager' in the XRM Toolbox provide an intuitive workaround. Although not supported in interactive mode, the 'Multi-table lookup' page on the Microsoft website outlines fundamental capabilities. It gives examples of JSON queries for creating lookup fields via the API.

Streamlining the process with the 'Polymorphic Lookup Manager' involves a straightforward series of steps:

  1. Solution and Referencing Table: In the 'Solution' and 'Referencing Table' fields, you specify the solution and the table name where the desired lookup will reside, respectively.

2. Attribute Configuration: In the 'Attribute' field, you can select an existing field or create a new one by choosing 'Create new polymorphic lookup.'

3. Lookup Display and Schema Name: In the fields 'Lookup Display Name' and 'Lookup Schema Name,' you can specify the parameters for the new field or display information about an existing one.
4. Referenced Tables: In the 'Referenced Tables' list, you can select or deselect tables that will be associated or dissociated from the lookup field.
5. Completion: The process is completed by clicking the 'Create Polymorphic Lookup' or 'Apply Changes' buttons.

As a result, you will obtain a polymorphic field that allows you to select records from the specified entities.

Addressing Challenges

While exploring how lookup fields work, we faced a challenge without readily available solutions. In certain situations, users couldn't see all the tables they needed to choose from. After some research, we found that when the linked entities list only contains published entities in the 'driven-app' or only unpublished entities, the entire list displays correctly. However, if both types are present, only the published ones appear. 

To fix it, publishing all entities added to the polymorphic lookup is crucial. To do this, access the 'driven-app' and include the required entities.


In conclusion, polymorphic lookups offer a valuable tool for optimizing data relationships within Dynamics 365. While the feature may not be officially supported, tools like the 'Polymorphic Lookup Manager' provide practical ways to implement and benefit from this functionality. As Dynamics 365 continues to evolve, polymorphic lookups will likely become more streamlined and accessible. Explore these capabilities to stay ahead in adapting to flexible data relationships.