Configure Customer lookup in canvas apps to show either contacts or accounts

Follow my blog for more interesting topics on Dynamics 365, Portals and Power Platform. For training and consulting, write to us at

Happy new year to all my blog readers and this is my first blog of 2020. And how about starting with a simple one and that too on canvas apps!

So this was my customer requirement. They were designing a canvas app for their business users which was basically kind of contact management. And while designing the contact edit form, they needed to show a form similar to the below one.


important fields to consider in the above screenshot are “Parent entity” & “Is company contact”.

Parent Entity field is nothing but the Company name (parentcustomerid) field of the contact. “Is Company Contact” is a custom field of type boolean.

In short the requirement was if that if the contact is a company contact, then the Parent entity field should allow users only to select Accounts else it should allow users to select only contacts. We will basically accomplish the following.

  • Show account/ contact dynamically depending on business logic
  • While switching between accounts and contacts dynamically, you may face the issue where either for contact or account, the display text does not show up. We are going to resolve that too.

So we set the Items property of the combobox with the below formula.

If(IsCompanyContact.Value = true,[@Accounts].’Account Name’,[@Contacts].’Full Name’)


If you are not aware of [@Accounts] or [@Contacts] syntax, refer to the Microsoft Docs link to learn more about record references.


So far so good. So we run the application.


So when “Is Company Contact” is selected, Parent Entity shows up the accounts as expected (screenshot above). Trust me, that’s the easy part. The one that will throw you off is the next one.


When the checkbox is unchecked, it should be showing the contacts. But below is how it shows up. Basically the contacts are loading but they are showing blank without any attribute value although we have specified fullname of the contact to show up in our formula.


We missed a simple thing and trust me it can consume some precious time of your day. The trick is to set the “Display Fields” property of the combo box. By default it was set to name for us and that’s the reason why account was showing us.


We changed that to the below formula. And now it showed up fine.

If(IsCompanyContact.Value = true,[“name”],[“fullname”])


Hope this helps!

Debajit Dutta

(Dynamics MVP)

For consultation/ corporate training visit or reach out to us at

Our product offerings:

Role based views for Dynamics 365 (

CRM-Sharepoint Attachment uploader and metadata manager (

Record Cloner for Dynamics 365 (

One thought on “Configure Customer lookup in canvas apps to show either contacts or accounts”

Leave a Reply