Skip to main content

Notifications

How to create a Form with a Multi-Select Checkbox in Dataverse

Ami K Profile Picture Ami K 15,654

@RezaDorrani  & @mdevaney created wonderful step-by-step tutorials on building multi select checkboxes in a Canvas App Form for a SharePoint list. A question I have seen raised on the Forums and in the comments section for both methods, is how to replicate this functionality for Dataverse.

Reza Dorrani video walkthrough: https://youtu.be/xUep4uud1BE

Matthew Devaneyhttps://www.matthewdevaney.com/power-apps-multiple-selection-checkbox/

 

The below walkthrough follows the same general instructions as provided above, but has been tailored with specific changes to accommodate Dataverse Choice Columns / Option Sets (whether Local or Global). I would recommend diving into those tutorials thoroughly before proceeding.

Instructions:

 

Initial set up

 

1. Create a Form control and include the multi-choice field from your Dataverse table. Note that a multi-choice field requires that the “Selecting multiple choices is allowed” toggle is set to On. 

Amik_0-1688758923812.png

 

 

2. I want my Form to be populated with information based on a selected record. Typically, we would enter "BrowseGallery1.Selected" into the Items property of the Form to do this. To keep this tutorial simple, I am going to add a Combo Box control into the App and set its Items property to my Data Source, as well as set my Unique ID field as the field to Display. 

 

 

Amik_5-1688760769249.png


Note that for the purposes of this tutorial, my Form is called "Form1", my multi-choice field is called "Local Multi Choice", my Dataverse table is called "Sample Issue Datas", and my Combo Box control is called "ComboBox1".

 

 

Adding a Gallery into the DataCard

 

1. Insert a blank vertical Gallery into your App


2. Cut and Paste the Gallery into the multi-choice Data Card


3. You should end up with the below


Amik_3-1688760009467.png


4. Unlock the Data Card for your multi-choice field and copy the Choices expression onto a Notepad; we will need to use this expression shortly.


Amik_2-1688759738176.png

 

5. Delete the default Combo Box in the Data Card. This is no longer required.


6. Note that doing so will result in errors in the Y property and Update property of the Data Card. For the time being, delete the expression in the Y property. We will deal with the Update property later


7. Insert a Checkbox control into the Gallery


8. Set the Items property of the Gallery to the Choices expression we copied earlier


9. Set the Text property of the Checkbox control to ThisItem.Value


10. Configure and format the Gallery as desired. For example, you may want to set the wrap count to 2 or 3 columns and adjust the Gallery size to fit neatly into the Form. See example below:

Amik_4-1688760331117.png

 

Expressions


1. On the OnSelect property of the Checkbox, enter:

 

 

 

 

Collect(
 ColSelectedItem,
 LookUp(
 Choices('Local Multi Choice (Sample Issue Datas)'),
 ThisItem.Value = ThisRecord.Value
 )
)
​​

 

 

 

 


2. On the Uncheck property of the Checkbox, use:

 

 

 

 

Remove(
 ColSelectedItem,
 LookUp(
 Choices('Local Multi Choice (Sample Issue Datas)'),
 ThisItem.Value = ThisRecord.Value
 )
)
​​

 

 

 

 


3. Set the Default property of the Data Card to ColSelectedItem


4. Set the Update property of the Data Card to ColSelectedItem


5. Select the Default property of the Checkbox control and enter:

 

 

 

 

 

If(
 'Your Form'.Mode = FormMode.New,
 false,
 ThisItem.Value in ComboBox1.Selected.'Local Multi Choice'
)
​​

 

 

 

 

------------------------------------------------------------------------------------------------------------------------------

Thank you.


If you like this blog, please give it a Thumbs Up.

Imran-Ami Khan

Comments

*This post is locked for comments

  • KrishR Profile Picture KrishR 431
    Posted at
    How to create a Form with a Multi-Select Checkbox in Dataverse

    @Amik , Can you please help me with this? I was able to submit the form to the dataverse table but unable to display the selected values in the checkboxes. 

     

    also, you've mentioned you added a combobox into the app and an you please help me how that's useful and where is it useful.

     

    Thank you so much 

  • jamesmao Profile Picture jamesmao 15
    Posted at
    How to create a Form with a Multi-Select Checkbox in Dataverse

    I followed your instruction step by step, until "Expressions".

    following steps all return with errors: "There is an error in this formula.  Try revising the formula and running it again."

    3. Set the Default property of the Data Card to ColSelectedItem

    4. Set the Update property of the Data Card to ColSelectedItem

     

  • rdefronzo Profile Picture rdefronzo 16
    Posted at
    How to create a Form with a Multi-Select Checkbox in Dataverse

    I tried your approach but my collection just returns "?".  Each time i click the boxes it adds to the collection, but uncheck does not remove any.  Presumably because the value does not = the record.  I copied your code exactly as above and just changed the choices part to be the choice from my table.  Any ideas why it does not work?