Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

How do I set a combobox with button that submits a value from a text field to the combo box

(0) ShareShare
ReportReport
Posted on by 634

Here is what I have.

 

  1. Combobox with list of products including a single item called "Add Product"
  2. A text box and button that appears if you select " Add Product"
  3. When you add a new product to the text box and click the button the entered value is added to the combobox, via a patch to the datasource, and the combobox is refreshed.

 

Here is what I want:

  1. When the button is clicked and the new value added to the datasource(combobox) I would like that new value to be selected when the combobox is refreshed.

Can this be done? I imagine it can. As an added bonus I'd probably want to hide the textbox and button when the button is clicked but I think that might be trivial assuming that the submission always works.

Categories:
  • Verified answer
    Future_Vision Profile Picture
    634 on at
    Re: How do I set a combobox with button that submits a value from a text field to the combo box

    Figured it out. I updated the button like this which seems to work

    UpdateContext(
     {
     newThird : Patch(
     'Third Parties',
     {'Third Party (cr9c7_thirdparty)':'Add 3rd Party TB'.Value}
     )
     }
    )

     

    Then set the DefaultSelectedItems to newThird

  • Future_Vision Profile Picture
    634 on at
    Re: How do I set a combobox with button that submits a value from a text field to the combo box

    I'm building the app in Teams and just selecting the "Create new table" option. Is that CDS or Dataverse?

     

    Where would I be setting the context variable. At the OnSelect of the button? Currently, I only have a Patch function that writes the value to the datasource.

  • GarethPrisk Profile Picture
    2,826 on at
    Re: How do I set a combobox with button that submits a value from a text field to the combo box

    Presumably the data source is Dataverse, or SharePoint.

    You can:

    1. Use a context variable to collect the value you are creating
    2. Patch the data source to create the value
    3. Reset the Combo Box (maybe, it can work without the Reset())

    The Combo Box's Default value would be the variable, which will help it to set it as the default value. Another tricky thing with Combo Boxes is that they can have single or multiple values. This will work for single values, but will require some additional considerations to work for multiple values.

    UpdateContext(
     {
     locSelectedValue: Patch(
     dataSourceName,
     Defaults(dataSourceName),
     {column: value}
     )
     }
    )

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,702 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,026 Most Valuable Professional

Leaderboard