Power Apps Multiple Selection Checkbox

Power Apps Multiple Selection Checkbox

Multiple selection checkboxes give a user the ability to pick from one or more options. This feature does not come included in Power Apps. Fortunately we can make our own by combining a single checkbox with a gallery.

In this article I will show you how to make Power Apps with a multiple selection checkbox.

Table Of Contents
Introduction: Projects Backlog App
Add A Choices Column To The SharePoint List
Convert Combo Box Into A Gallery
Tracking Current Checkbox Selections
Writing Multiple Checkbox Selections To SharePoint
Loading A Form With Multiple Checkbox Selections




Introduction: Projects Backlog App

The Projects Backlog App is used by a software development team to track a list of projects that need to be done. A Project Manager assigns Developers to complete projects in the backlog according to one or more required skills.




Add A Choices Column To The SharePoint List

Create a new SharePoint list to called Projects Backlog to store data for the app. Add the following columns:

  • Title (single-line text)
  • Start Date (date)
  • Estimated Hours (number)
  • Skills Required (choices)



The Skills Required (choices) column needs 4 options: Power Apps, Power Automate, Power BI and Power Virtual Agent. It must have the Allow Multiple Selections setting enabled to allow more than one skill to be chosen.




Input this data into the SharePoint list…

TitleStart DateEstimated HoursSkills Required
Time Off Request App3/8/202180Power Apps, Power Automate
Safety Incidents Reporting3/22/2021240Power Apps, Power Automate, Power BI
Job Site Inspection App4/6/2021150Power Apps, Power BI



…and the result should look like the image below. Great! Let’s move on to building the app.

Open Power Apps Studio and create a new canvas app from blank. Insert a form into the app with the Project Backlog SharePoint list as its datasource. Set the DefaultMode of the Form to this code.

FormMode.New



The form should include all 4 fields from the SharePoint list by default. Skills Required appears as a Combo Box. We will replace it with a multiple selection checkbox input.



Delete the combo box and expand the size of the card to make space for the checkboxes. Don’t worry about any error messages. We will address those soon.



Insert a blank vertical gallery into the card…



…and write this code in the Items property. The choices function will populate the gallery with a table of valid options.

Choices('Projects Backlog'.'Skills Required')



Then place a checkbox from the input menu into the gallery…



…with this code in the text property. The checkboxes will now have the names Power Apps, Power Automate, Power BI and Power Virtual Agents beside them.

ThisItem.Value




Tracking Current Checkbox Selections

The Project Manager adds or more skills to the project and submits the form. Now that we have built the multiple selection checkbox we must track which skills were selected in a collection and write it to SharePoint once the form is completed.

Select the checkbox we placed in the gallery…



…and use this code in the OnCheck property. When the checkbox is filled it will write the value to a collection called colSkillsRequired.

Collect(colSkillsRequired, ThisItem.Value)



Oppositely, we want to remove the skill from colSkillsRequired when a checkbox is unchecked.



Put this code in the OnUnCheck property of the checkbox

RemoveIf(colSkillsRequired, Value=ThisItem.Value)




Writing Multiple Checkbox Selections To SharePoint


The Update property of the card controls what data written is to SharePoint when the form is submitted. Change the Update property to colSkillsRequired.



One of the error messages is now gone. To get rid of the other error message simply delete the ErrorMessage label. We don’t need it for this app.



To submit the form, place a new button below the form…



…and write this code in the OnSelect property. Then click the button to write data back to SharePoint.

SubmitForm(Form_NewProject);



When the form is submitted, we want it to display the current record in view only mode.



A few more lines of code will do the trick! Use this code in the OnSuccess property of the form.

Set(varCurrentProject, Form_NewProject.LastSubmit); ViewForm(Form_NewProject);



Then write this code in the Item property of the form.

varCurrentProject




Loading A Form With Multiple Checkbox Selections

We’re not quite done yet. The Projects Backlog app needs to display skills required for a project when the Project Manager comes back later to review the project.

Make a new screen and place a blank gallery with Projects Backlog as the Items property onto it.

'Projects Backlog'




The gallery should look like the image below. Include a label with ThisItem.Title in the Text property to display the project name and a right arrow icon to indicate the row is selectable.



Write this code in the OnSelect property of the gallery to get the current project, the skills required, change the form to Edit Mode and then Navigate the the New Project Form screen.

Set(varCurrentProject, ThisItem);
ClearCollect(colSkillsRequired, varCurrentProject.'Skills Required');
EditForm(Form_NewProject);
Navigate('New Project Form');



You will not see any of the checkboxes highlighted. Why? We must assign a default value to them.



Use this code in the Default property of the checkbox.

ThisItem.Value in colSkillsRequired.Value



That’s it, we’re done!





Questions?

If you have any questions or feedback about Power Apps Multiple Selection Checkbox please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion.

Matthew Devaney

Subscribe
Notify of
guest
29 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Andrew Holding
1 year ago

Another great job. Came in expecting some combo box info because I was distracted. Came away with an awesome tip to adapt across a few scenarios.

Danielle D Taylor
Danielle D Taylor
1 year ago

THANK YOU! I have been struggling with checkboxes in my first app and that last bit of code should solve it. You have been a big resource in my first foray into PowerApps. Thank you.

Iain Ray
Iain Ray
1 year ago

Hi Matt, ive followed your guide and another very similar a bit older but the Update and Default properties both error saying that expect a record value and my collection is a table. The SharePoint field was originally just a single choice but have since made it multiple select (checkboxes), ive removed and re-added the field in the PowerApps SP form and also removed and re-added the SharePoint connector. Just cant get it to accept the collection of choices, any ideas?

Thanks

Colby Turybury
Colby Turybury
8 months ago

When placing colSkillsRequired into the Update field it show an error saying “Expected Record Value.”

Jacob
Jacob
7 months ago
Reply to  Colby Turybury

I’m having this same issue – any idea how to get around it?

Kevin
Kevin
5 months ago
Reply to  Colby Turybury

I am stuck with same issue. Did anyone figured it out?

Shilpa
Shilpa
5 months ago
Reply to  Kevin

I also Stucked in the same issue

Jorge
Jorge
8 months ago

Thank you for this post, I used to create a form and worked great, but no I’m asked to add a field that is visible when one specific checkbox is selected. If I tried using checkbox3.value it only shows the first checkbox, is there a way to refer to another checkbox on the gallery ? in this case my gallery have 7 checkboxes and the one I need to use to bring another field visible if selected is the last one.

powerapp.png
Jorge
Jorge
8 months ago

Thanik you so much, I was able to use your suggestion and works perfectly for an edit form, now I’m trying to figure out how can I check if a specific item was selected on a view form, I tried to use the UpdateContext on the OnVisible of the form but that gave me an error. I tried using thisItem.Value in Colletion inside the if, but that does not work.

Jorge
Jorge
8 months ago
Reply to  Jorge

After posting this I was able to figure out the view form part.
I used a filter on the collection to find out if the specific option was part of the collection and assign true or false to a variable to use on the visible property.

Luke
Luke
7 months ago

This is great – how difficult would it be to have a checkbox with an “Other _________” fill-in option, alongside the other checkboxes?

Ash Rakesh
Ash Rakesh
7 months ago

Hi Mathew, I have created a checkbox with multi selections and it gets updated in Sharepoint. I’m also using deeplinking to retrieve a record based on the link which is emailed to a user onSuccess of the form being submitted.
When using deeplinking, it retrieves my record, but the checkboxes remain unselected. Do you have any thoughts on what could be causing this issue?

Craig Cowley
Craig Cowley
6 months ago

Hi Matthew,

I’ve been trying to get this working for a week or so now, following this and a video.

I’m not using the onSuccess code as I’m sending to a SuccessPage. What I’m finding is that the choices are not being submitted to the SP List.

Also I’m seeing an error on the Default and Update properties fo the Datacard which contains the gallery.

Any assistance would be welcome.

Thanks

Last edited 6 months ago by Craig Cowley
Matthew Contri
Matthew Contri
5 months ago

I am thinking that he is receiving the same error as others for the Update where is states “Expected Record Value”. I am receiving the same error.

Matthew Contri
Matthew Contri
5 months ago

Thank you Matthew,

I was able to resolve this issue by doing the following:
1. Remove the checkbox control
2. Save the form and close
3. Open SharePoint List, delete column, and re add, ensuring that the “Multi Selection” flag is set
4. Open the form again and refresh the data connection
5. Re-add the checkbox control
6. And follow your tutorial, error is gone.

Dave White
Dave White
1 month ago

So I hit the same error ‘Expected Record Value’ but following Matthew Contri’s approach to rebuild the column for the multiple selection in SharePoint also did not work.

If I go to Update properties of my datacard where the checkboxes are and I type the name of my collection only, then I get an error similar to this: “colSkillsRequired = There is an error in this formula. Try revising the formula and running it again., | Data Type: Table

If I change the syntax under the Update properties of the datacard to instead be:{Value:colSkillsRequired} then the error goes away. However, then submitting my form does not appear to update the SharePoint list…

Anyone got any suggestions??

Manny Hanna
Manny Hanna
5 months ago

Hey Matthew,

Great tutorial. I am loving your site. I hit a little bit of a snag with this though and I know why, but hopefully you can help me get past it.

I am doing this directly from SharePoint Online to edit a NewForm for a list I created. The steps you outlined works great, when the checkboxes are being populated via a choice field. The problem I have is that my field is a SharePoint lookups to another SP list. When I complete my form and save it, those lookup fields don’t show up in SP.

any thoughts on how I can get around that?

thanks

Rina
Rina
5 months ago

Hi Matthew.
This is a great tutorial. I’ve used some of your tutorial for my project.
I would like to ask, is there any way when checkbox is checked, then it will open the next form in other screen. But the form that will open, is based on the checkbox i choose, for example, if i choose checkbox “a” then form “a” will appear, and so on.
Thank you in advance

Kyle C Mar
Kyle C Mar
1 month ago

Perfect Walk through. Thank you for this Article, other people are often skipping over important steps i.e. setting variables and what not. You covered everything and it works like a charm.

MICHAEL WAN
MICHAEL WAN
1 month ago

Great write up with detailed steps, thanks a lot! It works perfectly for me with one issue. All selected checkbox values are saved to SharePoint.

However, when I open up the existing list item in SharePoint view, it doesn’t show the selected checkbox values.

Tried to use varCurrentProject  on Item property of the form, it couldn’t be saved.

Anna
Anna
6 days ago

Thank you for this! The first part worked perfectly, until it came time to display the results. Do you have a solution for implementing checkboxes when using SharePoint integration, rather than a canvas app? No matter what I try, I can’t get the checkboxes to display the correct values in an edit form. Google tells me that others have encountered this issue too. Any ideas?