DYNAMICS 365 HOW TO CREATE POLYMORPHIC LOOKUP ATTRIBUTE 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 Attribute or Multi-Table Lookup that still in Preview.

A Polymorphic Lookup Attribute 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 Attribute 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 other posts, we saw how to create a Polymorphic Lookup Attribute using SDK and how to create a Polymorphic Lookup Attribute using WEB API

In this post, we will go through the steps to see how to create Polymorphic Lookup Attribute using the Polymorphic Lookup Manager plugin.
  1. Open the XrmToolBox, Install and Run the Polymorphic Lookup Manager plugin
    Polymorphic lookup Attribute 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 Attribute 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 attribute that will be displayed on the form
    • The Lookup Schema Name which is the schema name of the polymorphic lookup attribute
  3. When you are done from the options, click Create Polymorphic Lookup to create a new field
    Polymorphic lookup Attribute 2

  4. When the field is created, you will be notified by an alert
  5. The Polymorphic lookup attribute is now available and you can add it to the model-driven App form
    Polymorphic lookup Attribute 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 Attribute 5

      Polymorphic lookup Attribute 6

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

      Polymorphic lookup Attribute 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 Attribute 3

Bonus Tips:
  • In Advanced Find, the polymorphic lookup attribute 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 Attribute 9

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

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

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


Hope This Helps!

Comments

Popular posts from this blog

DYNAMICS 365 FILTER LOOKUP FIELD BASED ON N:N RELATIONSHIP

DYNAMICS 365 LEVEL UP BROWSER EXTENSION - PART 1 - FORMS

DYNAMICS 365 REFERENCE PANEL