Skip to main content

Notifications

Announcements

No record found.

DYNAMICS 365 HOW TO CREATE POLYMORPHIC LOOKUP FIELD OR MULTI TABLE LOOKUP

In Dynamics 365, you choose one table in the relationship when you create a Lookup field to relate to. While, for the Customer field type, you don't have the control to choose the tables, and by default the Account and Contact tables are the ones that the users can select from.

When it comes to the option of selecting from multiple tables in one single lookup field, we normally create multiple lookup fields and based on a specific condition, the needed lookup field will be shown on the form.

For many years, a desire has been hunger for by most people working in Dynamics 365 and by customers, which is the ability to select the value of a lookup field from records that exist in different tables.

Therefore, Microsoft has introduced the new feature called Polymorphic Lookup Field or Multi-Table Lookup that still in Preview.

A Polymorphic Lookup Field is a lookup field that points to multiple tables where the user has the option to switch between these tables in order to choose the needed record.

Currently, the creation of the Polymorphic Lookup Field can be only done through SDK or WebAPI. However, the new plugin Polymorphic Lookup Manager has been released in XrmToolBox to easily create and manage these type of lookups.

In this post, we will go through the steps to see how to create Polymorphic Lookup Field using the Polymorphic Lookup Manager plugin.
  1. Open the XrmToolBox, Install and Run the Polymorphic Lookup Manager plugin
    Polymorphic lookup field 1

  2. Once the plugin is opened, you have to choose
    • The Solution you are working on
    • The Referencing Table that represents the table in which you want to create the field
    • The Attribute that defines if you want to create a new Polymorphic Lookup field or to change an existing one
    • The Referenced Tables that lists all the tables where you can select specific tables to be part of the Polymorphic lookup
    • The Lookup Display Name which is the name of the polymorphic lookup field that will be displayed on the form
    • The Lookup Schema Name which is the schema name of the polymorphic lookup field
  3. When you are done from the options, click Create Polymorphic Lookup to create a new field
    Polymorphic lookup field 2

  4. When the field is created, you will be notified by an alert
  5. The Polymorphic lookup field is now available and you can add it to the model-driven App form
    Polymorphic lookup field 4

  6. Save and Publish the changes to see the Polymorphism in action and how it works
    • Clicking on the link "x types of records" to see all the tables and the records
      Polymorphic lookup field 5

      Polymorphic lookup field 6

    • Clicking on the Advanced Lookup link to display in a pop-up the list of tables and the records
      Polymorphic lookup field 7

      Polymorphic lookup field 8

  7. What is done in the back-end? New N:1 relationships will be created from the Referencing table with each of the chosen Referenced tables
    Polymorphic lookup field 3

Bonus Tips:
  • In Advanced Find, the polymorphic lookup field can be chosen in the conditions where you can choose different values from different tables to filter on, and the result will be filtered accordingly
    Polymorphic lookup field 9

  • The Polymorphic Lookup field can be shown in the Views and the appropriate record will be opened on the user click
    Polymorphic lookup field 10

  • You can manage an existing Polymorphic Lookup field relationships by selecting the field in Attribute option, doing the needed changes, and clicking the Apply Changes button
    Polymorphic lookup field 11

  • You can select a table from the list of Referenced Tables in order to change its relationship properties


Hope This Helps!

This was originally posted here.

Comments

*This post is locked for comments