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 / Change choice column's...
Power Apps
Answered

Change choice column's value by pressing button

(0) ShareShare
ReportReport
Posted on by 21

Hello,

 

I am using a SharePoint list ("Gestão de Ordens de Produção" is its name) as a data source. On this list i have a Choice column named "Estado" with 5 options to pick from. One of those choices is called "Cancelado".

 

I am build an app and somewhere on it i have an edit form used to alter the info on my SharePoint list items. On this form, i do not want the user to be able to change the "Estado" value, so i have the correspondent DataCard on Display mode: View.

 

I do want however, if needed, to be able to change the "Estado" choice only to the "Cancelado" value but none other. So i added a button to the edit form and i intended to automatically change the "Estado" choice to the mentioned value anytime this button is pressed.

If i understood correctly, i would be able to do this using the "Patch" formula on the button's "On select" property, but i haven't managed to figure out the correct way to type it.

 

I assume it should look something like this, correct?

Patch('Gestão de Ordens de Produção', ThisItem, {...})

 

Also, in your opinion, what is the correct approach to this problem: should pressing the button change the choice value on the edit form's DataCard or should it directly change the Choice columns value on the data source. I am quite inexperienced and do not know how it should work

 

I have already browsed some topics with similar questions to mine, but i have not been able to correctly apply their solutions to my own problem, hence I'm creating this topic.

 

Thank you in advance.

Categories:
  • Verified answer
    cha_cha Profile Picture
    4,932 Moderator on at

    Hello @Lourenço 

     

    Patch('Gestão de Ordens de Produção', ThisItem, {Estado: {Value: "Cancelado"}});

    **Replace the ThisItem with the code that points that exact list record. 

    If you are using a gallery to reference that form item, use Gallery1.Selected

    or maybe a LookUp

     

    As for your method, it's not bad, but it does require your user to do an extra step (clicking Edit) in order to cancel. If you don't want your user to have to press Edit before they Cancel you can always put the code readily available on the button. 

  • Lourenço Profile Picture
    21 on at

    Hey @cha_cha 

     

    I have to admit i did not understand what you meant when you said to replace ThisItem with the code "points that exact list record". Where do i see this come you mention?

     

    Anyways, if i simply write the

    Patch('Gestão de Ordens de Produção', ThisItem, {Estado: {Value: "Cancelado"}});

     code you mentioned (without replacing ThisItem), it seems like it already works like i intended it to. The items choice column changes to the wanted value when i press the button. Is there any consequence or "side effect" that i am missing tho?

     

    Thank you for your help btw

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