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 / Using a Button to Upda...
Power Apps
Answered

Using a Button to Update Choice Field

(0) ShareShare
ReportReport
Posted on by

Hi All,

Im looking to create a button to change a field (DropDown) in my form "Status" from a default of "1-New"to "5-Cancelled". My SP list name is 'Project Close'. I tried to use the Patch function, but ThisItem does not show up after the data list name. Any help would be appreciated! 

Categories:
I have the same question (0)
  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @apirez ,

     

    Please try below syntax:

    Patch('Project Close', ThisItem, {'Status':{Value:"5-Cancelled"}})

     

    Hope this helps.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • apirez Profile Picture
    on at

    @v-jefferni please see the attached screenshot. I think the issue with with ThisItem. I couldnt get that to show up when I first tried this. Thanks2022-04-21_19-51-42.png

  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @apirez ,

     

    Where is the button, in or out of the form? I was assuming the button was lying with the dropdown in a same data card. What is the Item of the form? You can simply replace ThisItem with exactly what's in the Item of the form. The second parameter of Patch represents the record that needs to be updated.

     

    Hope this helps.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • apirez Profile Picture
    on at

    @v-jefferni That seemed to work! Thank you! One more thing. I am trying to apply the same logic to two other forms and I cant seem to get syntax you provided to carry over, when I change the different attributes. I really appreciate your help!:2022-04-21_22-12-21.png2022-04-21_22-11-53.png

  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @apirez ,

     

    Try and use Gallery.Selected instead of ThisItem if you will always select items from the Gallery on the left.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • apirez Profile Picture
    on at

    @v-jefferni This still doesnt work for the other two screens.  Im getting a message :This formula has side effects and cannot be evaluated" just on the other screens. when I go to test, the button doesnt activate like the one that currently works. I really do appreciate you help on this. 

     

    Here is my syntax:

     

    Patch('New Project Request_1',Gallery2_1.Selected, {'Status:':{Value:"5-Cancelled"}})

     

    Patch('CC Mapping', Gallery2.Selected, {Status:{Value:"5-Cancelled"}})

  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @apirez ,

     

    I am not able to reproduce this issue, nor to find any relevant information on the web. Maybe you should try and disambiguate on all the three Patch functions:

    1. Set variables OnSelect of the respective Gallery:

    Set(varProjectNew, ThisItem)
    Set(varProjectClosed, ThisItem)
    Set(varCCMapping,ThisItem)

     

    2: Patch formulas:

    Patch([@'New Project Request_1'], varProjectNew, {Status:{Value:"5-Cancelled"}})
    Patch([@'CC Mapping'], varCCMapping, {Status:{Value:"5-Cancelled"}})
    Patch([@'Project Close'], varProjectClose, {Status:{Value:"5-Cancelled"}})

     

    Hope this works.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • Sidhant_02 Profile Picture
    986 on at

    Hi @apirez @v-jefferni ,
    I had a requirement which was similar which was on click of a button the Choice value should be updated ("" {Blank} -> Not Started -> In-Progress -> Completed) so for that I have created a Choice column in my SharePoint list named Status. I have posted the detailed information on Forum could you guys please have a look at and help with it:

    Query 


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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard