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 / Update drop-down when ...
Power Apps
Unanswered

Update drop-down when button pushed

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I've been searching this topic for hours but cannot find a specific use case that's working for me.

 

I have a PowerApps form that writes to a SharePoint list. There is a specific drop-down that writes to a choice column in the list. I want to maintain it as a drop-down, but under certain circumstances "automate" changing the value.

 

So the choice column (in SharePoint) is called "Status." The drop-down in PowerApps is called "Status_Combo."

 

The choice column has three choices: New, In process and Resolved. I already have the DefaultSelectedItems as New so that on creation of a new entry it populates it with that selection. Everything is working fine up to this point.

 

What I want to add is a pushbutton that, when pressed, does several things (such as incrementing the number in another column), but I also want it to look at the choice column and IF the current value is "New" change it to "In process." I already have the increment part working, but I've tried various combinations of the Patch function for the choice column, but I never see the value update.

Categories:
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Daryl_K 

    You would use a variable to do it.  

    In the control that sets the new form mode, NewForm(Form1); UpdateContext({var:"New"})

    In the button: Switch(var,"New", UpdateContext({var:"In Process"}),

                         "In Process", UpdateContext({var:"Resolved"})

    In the defaultselectedItems of the combobox: var

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Can I create the variable as part of the pushbutton also?

     

    If not, is there a "create" event that is spart of the form? I am using the standard "New" button in a SharePoint list to create a new instance of the form.

     

    P.S> I should add this is my very first Power App, so I am as "noob" as is possible. 🙂

  • Tufel_Sayed Profile Picture
    34 on at

    Hi @Daryl_K 

     

    I think there is an issue with your patch function.

    Make sure you are patching the choice value to SharePoint List as per the below format.

    Patch(

        YourDataSourceName,

        LookUp(

            YourDataSourceName,

            ID = RecordID

        ),

        {

            YourChoiceColumnName: {

                Value: "NewValue"

           

    }

        }

    )

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hmm, I don't get any errors entering this correctly, but it doesn't do anything when I press the button.

  • Tufel_Sayed Profile Picture
    34 on at

    @Daryl_K 

     

    I have put that code for your reference you can change your column name and list name according to your list and column names. You only have to check whether the patch function of yours is of that format or not. If it not in that format then  you can change and try to patch.

     

    Can you share Screenshot of Patch Function?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks for the reply. My current obstacle is the "ID" number. I assume this is the ID (row #) in the list (i.e. 0001, 0002) but the only way I know to get the right one is to use the ID field in Power Apps. Doing so this field displays the number correctly, but in your example it gives an error "Incompatible types for comparison. These types can't be compared: Number, Control." I assume this is because the DataCard here is a control type, but I cannot hard code a number here, so I must be doing something wrong.

     

    This is what it looks like, with ID# being the DataCard that reads the SharePoint list ID.

     

    2023-03-15_10-12-42.png

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    OK, I figured out the two dumb mistakes I was making: on was how to get the value on the control, the other was that I accidentally entered "list name" where it should have been "column name." I fixed both of those and now PA is happy (no errors) but when I press the button it just clears the drop down instead of putting in the desired value.

     

    2023-03-15_10-42-02.png

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    OK, I figured out the issue here: the code you provided IS working (once I corrected my mistakes). It does in fact change the column value if I watch it within SharePoint. My confusion is that I don't see that change reflecting in the PowerApps control...it remains blank.

     

    Maybe I should I be changing the control instead of the actual column value?

  • Tufel_Sayed Profile Picture
    34 on at

    @Daryl_K 

     

    As you mentioned that the column value is changed but the power apps control value does not change. So my question is the control you are using is part of the form or separate ?. If it is separate then you could not get the data because when you patch, it writes value to a specific record's column. 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    It is part of the form. The form itself is very basic, one screen, and writes to one list. It also receives some data from a second list for a few different dropdowns, but those are working correctly and are not related to or affected by this dropdown I am asking about.

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard