Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Suggested answer

How do I get an edit form combo boxes to behave the way I want them too?

(1) ShareShare
ReportReport
Posted on by 815 Super User 2025 Season 1
I originally asked this question back in July but had to put the project aside. That and there were no good solutions at the time. You can read my post here. https://community.powerplatform.com/forums/thread/details/?threadid=bb02a0b8-bc4e-ef11-a317-6045bdd88b0e
 
I am revisiting this and figured I'd try and lay out the situation again and see if we can come up with a good strategy, 
 
Here is my situation
  1.  I have a gallery that returns records from Dataverse table
  2. When you select a gallery item the record is written to a global variable (I used a global variable because there is also a copy record function on the page that navigates the users back to the original form and populates it with the copied record for editing)
  3. I have a form on the page that uses the global variable data as the Items property
  4. In the form I have some dependent combo boxes. These function as expected. When and item from the parent is selected the values available in the child combo box are changed.
This all works fine. But I am having issues with the behavior I want the child combo boxes to have. Here is what I want to happen.
  1. When a parent combo box is changed I want the child combo box(es) to appear blank.
  2. If the child combo box is required I want that to be respected by the form
My issue has been how to get this to work. Here is what I have tried. 
  1. For the parent combo box I am setting the OnSelect property to a context variable 
    UpdateContext({varResetSubLedgerReview: true});
  2.  I set the Reset property of the child to this value 
    varResetSubLedgerReview
  3. The DefaultSelectedItems for the child combo box is
    {Value:If(varResetSubLedgerReview,Blank(), Parent.Default)}
This works the first time around but fails if I were to change the parent combo box again since the variable is still set to true.
I've tried setting the variable back to false using the OnSelect of the child combo box. That does work to reset the variable, but the side effect is that the logic in the DefaultSelectedItems, for the child, fails. Instead of the blank remaining it is replaced with the Parent.Default. Any thoughts on what needs to be done here? Maybe I need a second variable? 
  • futr_vision Profile Picture
    815 Super User 2025 Season 1 on at
    How do I get an edit form combo boxes to behave the way I want them too?
    Any other ideas?
  • futr_vision Profile Picture
    815 Super User 2025 Season 1 on at
    How do I get an edit form combo boxes to behave the way I want them too?
    @yonie
     
    Once I add the code to the grandparent combo box I get this error
     
  • futr_vision Profile Picture
    815 Super User 2025 Season 1 on at
    How do I get an edit form combo boxes to behave the way I want them too?
    @yonie. 
     
    I haven't done exactly what you are saying but I've tried to leverage OnChange. Problem is that whenever you select a new record it triggers the OnChange. Not sure if that will affect your code or not but I wanted to point that out. 
  • Suggested answer
    yonie Profile Picture
    35 on at
    How do I get an edit form combo boxes to behave the way I want them too?
    I would do the following:
    1. In the OnSelect() from your Gallery
      Navigate(FormScreen,ScreenTransition.Fade, {SelectedGalleryItem: ThisItem});
      ResetForm(Form1);
      EditForm(Form1);
      2. In your form use the default item as follows
      SelectedGalleryItem
      3. Then assuming you have 3 comboboxes, set the OnChange() property to
      • Combobox1 (Grandparent)
        If(Self.Selected.Id <> SelectedGalleryItem.Combobox1.Id, 
        UpdateContext({SelectedGalleryItem: Patch(SelectedGalleryItem, {Combobox1: Self.Selected, Combobox2: Blank(), Combobox3: Blank()})});
        Reset(ComboBox2); Reset(ComboBox3))
         
      • Combobox2 (Parent)
        If(Self.Selected.Id <> SelectedGalleryItem.Combobox2.Id, 
        UpdateContext({SelectedGalleryItem: Patch(SelectedGalleryItem, {Combobox2: Self.Selected, Combobox3: Blank()})});
        Reset(ComboBox3))
         
      • Combobox3 (Child)
        Nothing
         
      4. In your datacard you should set that the value is required, when submitting the form it'll check if it has a value.
       
  • futr_vision Profile Picture
    815 Super User 2025 Season 1 on at
    How do I get an edit form combo boxes to behave the way I want them too?
    If I remove this code for DefaultSelectedItems, in the child combo box
     
    {Value:If(varResetSubLedgerReview,Blank(), Parent.Default)}
    and replace with
    {dk_subledgername: Parent.Default}
    This works but this obviously breaks the ability to blank out the child combo box.
     
    I tried replacing 
    {Value:If(varResetSubLedgerReview,Blank(), Parent.Default)}
    with
    {Value:If(varResetSubLedgerReview,Blank(), {dk_subledgername: Parent.Default})}
    but this just puts [object Object] in the child combo box
  • futr_vision Profile Picture
    815 Super User 2025 Season 1 on at
    How do I get an edit form combo boxes to behave the way I want them too?
    I just reviewed the child combo box I've initially been working on and see what is happening. It is still broken. Here is what I experience.
    1. Change the parent and the child box becomes blank - 
    2. Seclect a new value in child combo box
    3. Submit
    4. All works well
    5. Edit a record that has a value for the child combo box
    6. Edit a different combo box or just resubmit
    7. A blank gets written to the record for the child combo box.
    I hope I explained the behavior. Not really sure what is happening there. There is nothing setting the variable to true that would trigger the reset of the child combo box. I dropped a label on the screen to see what the default is for the data card. It holds the expected value. I added a second label to see what the selected value for the combo box is and that is blank. This seems to be the same thing happening with the required combo box mentioned in my previous post. Thoughts?
  • futr_vision Profile Picture
    815 Super User 2025 Season 1 on at
    How do I get an edit form combo boxes to behave the way I want them too?
    Or maybe it does work. It seems like PowerApps is finicky about these things. Sometimes things work and other times it fails. I am noticing another issue however. When a child combo box is required, even though there is a value there and that value is never touched, the submit fails because it is saying that combo box is required.
  • futr_vision Profile Picture
    815 Super User 2025 Season 1 on at
    How do I get an edit form combo boxes to behave the way I want them too?
    Right, but when I change the value in the child combo box the variable is still true which means the value is blank. When I submit the blank is written to the table. What I find odd is that if I were to edit that same record again, the value I chose in the child combo box gets written to the table. Maybe because it is already blank? I'm not sure I understand exactly what is happening there.
  • WarrenBelz Profile Picture
    146,513 Most Valuable Professional on at
    How do I get an edit form combo boxes to behave the way I want them too?
    Sorry, but I am a bit unclear here
    When a parent combo box is changed I want the child combo box(es) to appear blank.
    If you are doing this OnChange of the Parent Combo
    UpdateContext({varResetSubLedgerReview: false});
    UpdateContext({varResetSubLedgerReview: true});
    it sets The Variable varResetSubLedgerReview to true and triggers two things
    The Reset of the child box and then 
    The Default Selected Items of the child is
    {Value:If(varResetSubLedgerReview,Blank(), Parent.Default)}
    which means it should display blank every time you select the parent control.
  • futr_vision Profile Picture
    815 Super User 2025 Season 1 on at
    How do I get an edit form combo boxes to behave the way I want them too?
    I've tried this before but the problem is, when these variables are set to true, the DefaultSelectedItems of the child combo box is set to Blank. When you submit the update, the value is not what you selected in the combo box but the blank 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

Thomas Rice – Community Spotlight

We are honored to recognize Thomas Rice as our March 2025 Community…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,513 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,554 Most Valuable Professional

Leaderboard