Field controlsModel-driven app

Customer lookup

A lookup that can point to an account or a contact, with results grouped by table in the flyout.

Show me in the demoOpens the demo app with this component highlighted.

What it is

A customer lookup is a polymorphic lookup: one column that can hold either an account or a contact. In the flyout the results are grouped by table, so you see Accounts and Contacts as separate lists. After you choose, the pill shows the name and opens the right kind of row.

Because the value can be either table, the column stores both the row id and the table it belongs to.

When to use it

Use it when the business relationship can be with a company or with a person, as on cases, opportunities and quotes in Dynamics 365.

If the target is always one table, use a plain Lookup. Microsoft Learn notes that a customer lookup can only relate to the account and contact tables. For other combinations you would need a custom multi-table lookup, which today is created through the SDK or the Web API.

Licensing and configuration

No extra licence. Create a column of data type Customer in the table designer, which adds the relationships to both tables. Both tables must be in the app, otherwise the flyout only offers the one that is. In the form designer you can set the default view and whether users can change views, like any lookup. A table can have more than one customer column.

Pitfalls

  • Reports, flows and code must handle both targets. A formula that assumes an account will fail for a contact.
  • Column mapping and quick view forms need a setup per target table.
  • Filters on the customer column match the name, not the table, so two records with the same name can look alike.
  • Custom activities and portals often expect specific customer columns, so check before adding extra ones.

Try it in the demo

  1. Open the first accelerator and select the Customer field in the Controls tab.
  2. Read the grouped results, then choose an account such as Wayne Enterprises.
  3. Replace it with a contact such as Bruce Wayne.
  4. Check that the pill opens the matching row.