How to configure a multiselect Lookup

Byron Dittberner | image displaying multiple accounts being selected

Have you ever needed to configure a multiselect lookup? Recently while working on a Dynamics 365 implementation, I was asked to create a dropdown that has the following features.

Customer Specific Requirements

  • A user should be able to select more than one item from the dropdown
  • The dropdown would contain in excess of 100 items
  • A system user should be able to add items to the options without the need for a developer
  • A user should be able to search the options
  • Option should be sorted alphabetically

When reading the requirements, you may think this could be implemented with a standard Choices (multi-select) column, however, some of the expected features will not be possible while others will be difficult to manage, particularly the ability for a user to manage the list of options which would require the user(s) to have access to the PowerApps maker.

Review the requirements

The ideal solution would be a lookup column that a user can select more than one record. Let’s review the requirements and confirm which of them are supported by a lookup column;

  • A user should be able to select more than one item from the dropdown
    • Standard lookup columns do not support multiple select.
  • The dropdown would contain in excess of 100 items
    • With a high number of options to select from, a lookup would be the preferred solution.
  • A system user should be able to add items to the options without the need for a developer
    • In order for a user to access updating a Choice(s) column they would require access to the PowerApps maker environment which is not advisable. It is much better to have large lists managed through lookup reference tables.
  • A user should be able to search the options
    • Search and filtering are only available with lookups further confirming that lookups would be the preferred approach.
  • Option should be sorted alphabetically
    • This is something Choices(multi-select) columns do not do very well, in fact, once the list of options is created the order cannot be changed, that is without script of course. Lookups use views to display the options and we all know that view filtering is completely configurable.

Well, there is good news. You may not have known but there is a built-in component that is shipped with Dynamics 365 Field Service that enables system administrators and customizers to configure a multi-select lookup.

The setup is rather simple and does not require any code. I will explain step-by-step how to configure the lookup.

How to configure multiselect lookup

Please note that the component (MultiSelect LookUp) is shipped with Dynamics 365 Field Service and is not available in a PowerApps only environment. For alternatives in case you do not have Field Service installed, check out this PCF control.

Scenario – We will use a simple use case to demonstrate how to configure the multi-select lookup. Let’s assume you would like to associate more than one account to a contact using a multi-select lookup.

Follows these steps on how to configure a multiselect lookup

  1. Login into the PowerApps Maker
  2. Confirm that you have selected the correct environment that has Dynamics 365 Installed.
  3. Select Dataverse on your navigation, the select Tables
  4. Select the Contact table

5. Create a new column called Accounts, be sure to set the properties as follows as per the images on the right. Click on save once you are done.

Display name: Accounts, Data Type: Text, Advanced settings – Max Characters: 4000

6. Next add the Accounts column to the Contact Main Form, then click on Save and Publish.

Select the image on the right to view a sample.

Byron Dittberner | Add the accounts field to the form

7. Next, we will need to add the multi-select control to the form. At the time I wrote this article, the component was not available in the modern maker experience so you will need to click on Switch to Classic.

Select the image on the right to view a sample

Byron Dittberner | switch to the classic editor

8. Double click on the Accounts column to open the field properties, then select the controls tab.

Select the image on the right to view a sample

Byron Dittberner | set the field properties

9. Click on Add Control, the scroll down and look for the Multiselect Lookup Control, select it and then click on Add

Select the image on the right to view a sample

Byron Dittberner | set the multi select control

10. Before you are able to configure the control, you will need to get the view id for Active Accounts. To do this, open a new browser tab and open a new session of the PowerApps maker. Confirm that you are in the correct environment. Open one of the Dynamics 365 apps, then select Accounts on your navigation. Ensure you have set the view to Active Accounts. Copy the viewid from the URL. Save the view id.

Click on the picture on the right to view a sample

Byron Dittberner | Select the view id from the active accounts

11. Next, you will need to configure the properties for the control. By default, the Property_Display_Key should already be populated. Click on the pencil icon next to entityName_Display_Key, select Bind to Static Value and then set the SingleLine.Text property to account (all lower case). Next, set the viewidDisplay_Desc_Key to the viewid you copied in the previous step.

Click on the image on the right to view a sample

Byron Dittberner | configure the lookup control

12. View the picture on the right and confirm your settings look the same. Please note that the view id will most likely be different. Ensure you set the control to be visible for Web.

Once you have confirmed that your settings are correct, click on Ok and the dialog box will close.

Byron Dittberner | How to create a multiselect lookup in Dynamics 365

You are nearly done, finally you should publish the changes. While still in the classic editor, click on Save, then click on Publish. Once published, click on Save and Close. Once the classic editor closes, you should be viewing the Contact Form in the PowerApps Maker. DO NOT CLICK ON SAVE! you need to refresh the browser (press Ctrl + F5). If you click on save without refreshing, your changes will be undone because the changes you made were done in a different session.

Time to test the control. Refresh the Dynamics 365 App and your new multi-select lookup should be displayed. try it out and select more than one account and click on save. View the images below for sample of the completed solution.

Byron Dittberner | How to create a multiselect lookup in Dynamics 365
This is how multiple accounts will display, click on the number (+3) next to the account name to view the entire list of accounts.
Byron Dittberner | How to create a multiselect lookup in Dynamics 365
This is how multiple selected accounts will be displayed.

Thats it, simple as that you now know how to configure a multiselect lookup. There is one snag though, if you add the Accounts column to a view the text that is displayed in a JSON blob which is nasty. So, my advice, do not add this field to a view. I will be publishing an article explaining how to display the list of selected accounts in a multiline text column where each account is comma separated.

I hope you found this article helpful.

Until next time, happy CRMing!

Byron Dittberner | Dynamics 365 & Power Platform Solution Architect

13 comments

  1. David Anderson - Reply

    Hi Byron, nice article.
    I n your post you said “Ensure you have set the view to Active Accounts” but in your screen clip you show “Active Contacts” was this intentional or a mistake.

    What are the options for security on this Field/Lookup?

    Thank you!

    • Byron - Reply

      Hi David

      Thanks for spotting this issue, I have replaced the image.

      From the security perspective, you will still have the standard entity-level security and field security. In addition, you can also select your preferred view id if you would like the records to be filtered.

      I hope this provides some clarity.

  2. Michael - Reply

    Hi, I installed the solution, but the Multi Selection is not appearing in Add Control of the Accounts Field as per the example above. What could I be missing?

    • Byron - Reply

      There are a few things you need to check in order to use the control described in this post.

      1. Are you trying to use the Control in an Environment where Dynamics 365 is installed?
      2. Are you trying to add the Control from the classic editor? (see step 7)

      These are the most likely reasons you are not able to add the Control.

    • Byron - Reply

      You need to install Dynamics 365 Field Service trial, this will provide you with the require solution components.

  3. anagrou - Reply

    Hello! I have a doubt regards reporting. Will users be able to create reports with this? will the dashboards present accurate information?

    • Byron - Reply

      You will be able to create reports with this field, as long as you have converted the JSON to a comma-separated string. Please see the follow up article, the link is at the end of this article.

  4. Paradis - Reply

    Thanks for the clarification. Is this feature only available in dynamic365 or can it be used in a model-driven app?

    • Byron - Reply

      This feature can be used in any model-driven app, however, the control is packaged with Dynamics 365 Field Service. So, If you have previously installed a Field Service trial or have Field Service, then this solution would be available.
      If your environment is a pure PowerApps then the component will not be available. There are a few options available as PCF controls, checkout this one, https://pcf.gallery/association-table-control/

  5. henry - Reply

    hello sir, can I use the multiple lookup in offline mode??. If not, are there any document about it?

    • Byron - Reply

      I have not tried it, but it sounds plausible. You would need to have both parent and child (lookup table) configured for offline mode. Give it a try and let me know if it got it to work.

Leave a Reply

%d bloggers like this: