Are you required to set a combo box value based on a button click in Power Apps? If Yes, Then follow this complete tutorial to achieve it. Here, I will show you “How to set a combo box value on a button click in Power Apps”
For that, I created a form containing the Dropdown control (Issue) and a Combo box control (Connected to Office365Users). When a user selects a value from the dropdown control and clicks on a button control, the combo box control will automatically select a user who is responsible for that specific issue.
Set Combo Box Value On Button Click in Power Apps
Here, I will explain how to change a combo box value based on a button click.
I have a SharePoint Online list [IT Service Request], that has various columns like:
|Column Name||Data Type|
|Employee Name||Single line of text|
|Issue||Choice [“Laptop”, “Network”, “Outlook”, “Other”]|
|Issue Handled By||Person or group|
Now let’s see how to achieve it:
- Create a Blank canvas app -> Connect to the SharePoint Online list as shown below:
Step 1: [Insert a Dropdown control and connect to an above SharePoint list column]
- Insert a Dropdown control -> Set its Items property to:
Choices('IT Service Request'.Issue)
- IT Service Request = SharePoint list name
- Issue = SharePoint list choice column name
Step 2: [Insert a Combo box control and connect to an Office365Users]
- On the +Add data -> Connect the Data source to an Office365Users.
- Insert a Combo box control -> Set its Items property to:
Step 3: [Insert a button control and create a variable to set a combo box value]
- Insert a Button control -> Set its OnSelect property to:
Set( varIssue, If( DrpIssue.Selected.Value = "Laptop", "Henrietta Mueller", If( DrpIssue.Selected.Value = "Outlook", "Lynne Robbins", If( DrpIssue.Selected.Value = "Network", "Lidia Holloway", "Megan Bowen" ) ) ) )
- varIssue = Provide the variable name
- DrpIssue = Dropdown control name
- Laptop, Outlook, Network = SharePoint list choice column values
Step 4: [On the combo box control, assign a variable to set a combo box value]
- Select a Combo box control -> Set its DefaultSelectedItems to:
- varIssue = Assign the variable name here
- Save, Publish, and Preview the app, when a user selects a value from the dropdown control [Issue] and clicks on a button control. The combo box will automatically select a user who is responsible for that specific issue.
This is how to change a combo box value based on a button a click in Power Apps.
Whenever you need to change a Power Apps combo box value by clicking a button control, you can set a variable on the button control by storing the combo box values.
In this Power Apps tutorial, I have shown you how to set a Combo box value on a button click in Power Apps.
You may also like:
- Reset Combobox in Power Apps
- How to Populate Distinct Values in Power Apps Combo Box?
- Power Apps Combo Box Sort
- Power Apps check if a Combo box is empty
Preeti Sahu is an expert in Power Apps and has more than 6 years of experience working with SharePoint and the Power Platform. As a Power Platform expert for Power BI, Power Apps, Power Automate, Power Virtual Agents, and Power Pages, she is currently employed with TSinfo Technologies. She is the author of the book Microsoft Power Platform A Deep Dive. She also made a big technical contribution to SharePointDotNet.com in the form of articles on the Power Platform. She enjoys traveling and spending time with her family in her spare time.