How to Set Power Apps Combo Box Value On Button Click?

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 Power Apps Combo Box Value On Button Click

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.

Example,

I have a SharePoint Online list [IT Service Request], that has various columns like:

Column NameData Type
Employee IDTitle
Employee NameSingle line of text
IssueChoice [“Laptop”, “Network”, “Outlook”, “Other”]
Issue Handled ByPerson or group
Power Apps set combo box value on button click

Now let’s see how to achieve it:

How to set s Power Apps combo box value on button click

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)

Where,

  1. IT Service Request = SharePoint list name
  2. Issue = SharePoint list choice column name
Change a Power Apps combo box value by clicking a button control

Step 2: [Insert a Combo box control and connect to an Office365Users]

  • On the +Add data -> Connect the Data source to an Office365Users.
Power Apps change combo box value on button click
  • Insert a Combo box control -> Set its Items property to:
Office365Users.SearchUser({searchTerm: cmb_IssueHandledBy.SearchText})
Change Power Apps combo box value by clicking a button

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"
            )
        )
    )
)

Where,

  1. varIssue = Provide the variable name
  2. DrpIssue = Dropdown control name
  3. Laptop, Outlook, Network = SharePoint list choice column values
How to change a Power Apps combo box value by clicking a button

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]

Where,

  1. varIssue = Assign the variable name here
Set Power Apps combo box value with button control
  • SavePublish, 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.
How to set a combo box value on button click in Power Apps

This is how to change a combo box value based on a button a click in Power Apps.

Conclusion

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: