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.
-
Open the XrmToolBox, Install and Run the Polymorphic Lookup Manager plugin
-
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
-
When you are done from the options, click Create Polymorphic Lookup to create a new field
- When the field is created, you will be notified by an alert
-
The Polymorphic lookup attribute is now available and you can add it to the model-driven App form
-
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
-
Clicking on the Advanced Lookup link to display in a pop-up the list of tables and the records
-
Clicking on the link "x types of records" to see all the tables and the records
-
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
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
-
The Polymorphic Lookup attribute can be shown in the Views and the appropriate record will be opened on the user click
-
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
- You can select a table from the list of Referenced Tables in order to change its relationship properties
Hope This Helps!
Comments
Post a Comment