In dataverse, a custom multi-table (polymorphic) lookup allows you to create a relationship between multiple tables with a common field. This is similar to a regular multi-table lookup or joins but with the added flexibility of relating to multiple tables using the same field.

Users can create and modify custom multi-table lookups at this time via the SDK or Web APIs. Interactive user interface support will be coming in a future release. How it is done can be found on this learn page.

Microsoft has released a new feature within custom multi-table lookups where we can now include virtual tables, including the AAD user table. Let’s have a look at how we can do this.

How do we do this the easy way?

We create a custom table (entity) in a solution that I have called “customer”. In this table, we will add the multi-table lookup that includes two system tables (Users and Application User) and the virtual table of AAD users. You can create the lookup in the table customer via the SDK or Web APIs. Here we will use XrmToolBox with the tool Polymorphic lookup manager. The tool will create for us the multi-table lookup in the table customer.

Open XrmToolBox and connect to your environment. In this example, we have a predefined environment connection configured that we connect to.

Select a connection, click “Connect”, and search for a tool named: “Polymorphic Lookup Manager”. Select and open.

Select the solution and preferencing table. In the attribute, you select a value: “Create new polymorphic lookup”. Give a display and schema name for the new multi-table lookup and select all reference tables that will be included.

It will result in something like the above and correctly filled in, you can create the multi-table lookup in the selected table by pressing “Create Polymorphic Lookup.”

Adding the table to a model-driven app will result in the following result:

Result

It is easy to implement a multi-table lookup via XrmToolBox, and we can now use virtual tables in the multi-table lookup. It will allow us to use multi-table lookups with virtual tables.

If you like this blog. Please give me a dumbs up, share the blog or leave comments below.

Photo by Shubham Dhage on Unsplash

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: