web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / ComboBox - How to make...
Power Apps
Unanswered

ComboBox - How to make it default to newly added item?

(0) ShareShare
ReportReport
Posted on by 514
I have a text box that I use to enter a new item, which when saved then gets added to the items in my combobox.
Is there a way of making the combobox default to the new added item?

I have tried a filter in selecteditems to filter the datasource to the value in the text box, but it does not appear to
work. Something like filter where Title = "value in text box"
 
I thought I had it working previously though doing it this way. I am not using forms, but am doing the save via patch.
 
Any help appreciated
 
Thanks
Categories:
  • WarrenBelz Profile Picture
    156,956 Most Valuable Professional on at

    Hi @sienna28 ,

    What is the Items property of the ComboBox.

    If it from a collection, you can refresh the data source after submitting the item and then recollect, otherwise refreshing the data source should do it.

    I can answer in more detail if needed when I see the structure.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • sienna28 Profile Picture
    514 on at

    Hi

     

    The items property is a SharePoint list.

     

    It only comes from a collection if the screen is in edit mode.

    For this issue, the screen is not in edit mode so the data is coming directly from a SharePoint list.

     

    When saving I do refresh the datasource and the new item has been added.

    Just that I cannot get it to be automatically selected in the ComboBox.

    Perhaps wrapping the whole thing in a collection is the easiest way to do it....I am unsure.

     

  • WarrenBelz Profile Picture
    156,956 Most Valuable Professional on at

    Hi @sienna28 ,

    Totally agree with the Collection - almost all of my ComboBox/DropDown values are done with them.

    Refreshing the data and doing a ClearCollect always seems to work. Bear in mind that you could collect different data conditionally (or have two collections) and still get the result you have now.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

  • sienna28 Profile Picture
    514 on at

    Thanks, but how do you actually get the newly saved item to show as the default in the combobox?

    After refreshing the datasource, is there some piece of code that needs to be added?

  • WarrenBelz Profile Picture
    156,956 Most Valuable Professional on at

    Ok @sienna28 ,

    A little tricker - I would go with a Variable, a Reset  and Default on the ComboBox.

    Set the Variable to the new item value, and in the Default of the ComboBox 

    If(
     !isBlank([Variable])
     [Variable],
     [What it is now]
    )

    then be sure to set the Variable to Blank() after this.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • sienna28 Profile Picture
    514 on at
    Sorry but I can't really make head or tail of your solution. Seems very cryptic code. Can anyone else lend a hand?
  • WarrenBelz Profile Picture
    156,956 Most Valuable Professional on at

    Hi @sienna28 ,

    I am happy for anyone else to come in, but you must understand that our small group of volunteers that try to assist users have absolutely no idea of the progress in the PowerApps journey that you have taken when providing a solution.

    We generally try to provide direction on where you should look for a solution and your previous replies and your status level lead me to assume that the guidance I gave would have given you this, however I am happy to elaborate further to assist.

    Firstly, the Default value of a control can be changed with a Reset command initiated by another action and the control will be set to the value in this Default value. You can also make this Default value conditional, in this case by a Variable initiated by the first action.

    So to explain the sequence of events (as posted earlier) I will assume the following:-

    • The Default of Combo1 is Parent.Default - if it is different, then you need to simply replace Parent.Default with this value.
    • I am going to call the Variable vReset - you can name it whatever you want.
    • I will call the ComboBox Combo1 below - replace this with the value of your control.
    • I will assume the new item is from the text box NewItem - again replace this with your control name.

    Firstly, set the Variable vReset to the new item value on the saving of the record and reset Combo1

    UpdateContext({vReset:NewItem.Text});
    Reset(Combo1)

    and in the Default of the Combo1 

    If(
     !isBlank(vReset)
     vReset,
     Parent.Default
    )

    so when Combo1 is reset and vReset is true, it will reset to the value of vReset.

    The last bit is better on probably screen exit to reset the variable so Combo1 will take the stored data when opened.

    UpdateContext({vReset:false})

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • eka24 Profile Picture
    20,925 on at
    The idea is to set a variable to pick the new item that has been created. Then save it into a collection. After that you can be able to pick the new item from the combobox or dropdown as default.
    So follow this:
    1. On the SAVE Button:
       Set(MyNewItem,Textbox.Text); SubmitForm(YourFormName)
     2. Put this OnSuccess property of the form:  ClearCollect(CollMyNewItem,{ID:MyNewItem})
         Replace the textbox with the datacardvalue where the item would be entered in your form. 
    3. Finally, on the Default property of the combobox or dropdown put this on the  items property:  CollMyNewItem.ID
    I have tried it. It worked. 
     
    If you like this post, give a thumbs up. Where it solved your issue, Mark as a solution

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 243 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 204 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard