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

Community site session details

Session Id : BKG1ecI4l9h1pTez0ySNsa
Power Apps - Building Power Apps
Answered

Power App change value of a button when click on the other button

Like (0) ShareShare
ReportReport
Posted on 16 Sep 2022 18:41:55 by 40

I have a choice list in SharePoint with two values " pending approval" & "approved". I would like to change the value to be approved for the specific field when the user clicks on the button that says " Submit".  Please advise what is the best way to that?  

 

etharAli_0-1663353353255.png

 

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on 16 Sep 2022 at 21:16:57
    Re: Power App change value of a button when click on the other button

    @etharAli 

    Yes, you cannot set values like that in PowerApps, everything is done via formulas that evaluate their values.

     

    So, what I was looking for with my questioning was context - what was the context of your record.  I can see now at least that it appear to be that you are referencing ThisItem, so you are in the Context of the Gallery and therefore, you most likely have the primary key of the record - the ID.

     

    In that case, your Submit button OnSelect action formula should be:

    Patch(yourDataSource, 
     {ID: ThisItem.ID,
     Status: {Value: "Approved"}
     }
    )

    This will set the value to approved.

     

    Incidentally, you were trying to use the Pressed property of the button control...it is only true when the button is being pressed...once released, it is false!

     

  • etharAli Profile Picture
    40 on 16 Sep 2022 at 20:31:35
    Re: Power App change value of a button when click on the other button

    I have a gallery on top of another gallery. The first bottom of the gallery is just a data source linked to the Sharepoint list. The second gallery builds as a dialogue box pop up when the user clicks on Pending approval.  

     

    etharAli_0-1663360118053.png

    instead of ThisItem.staus.value. I would like to write if condition to switch the value in the column named "Status " from "pending approval" to "approved" when the user clicks on Submit. I wrote the following code but it's wrong. 

    If(ThisItem.aSubmit.Pressed, (ThisItem.Status = 'Approved'), (ThisItem.Status.Value : 'Pending Approval'))

  • RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on 16 Sep 2022 at 20:19:35
    Re: Power App change value of a button when click on the other button

    @etharAli 

    What I am really asking (thanks for answering the first question) in the second question is - you are showing data in your screenshot obviously from your record in your list.  Where are you getting that data?  Or in other words...what is the ID of the record you are displaying and wanting to update?

  • etharAli Profile Picture
    40 on 16 Sep 2022 at 20:02:54
    Re: Power App change value of a button when click on the other button

    The data source for the screen holding all the columns is  called " Test Requests " 

  • etharAli Profile Picture
    40 on 16 Sep 2022 at 20:00:21
    Re: Power App change value of a button when click on the other button

    The pending approval button  is a choice list linked to the column named  "Status in" in the SharePoint list, please see below: 

    etharAli_0-1663358197637.png

     The column default value is set to be " Pending Approval". I would like to change this value to be "Approved" when the user clicks on the other button called " Submit"

  • RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on 16 Sep 2022 at 19:53:47
    Re: Power App change value of a button when click on the other button

    @etharAli 

    Change the value of approved where??  What column holds that information, and what kind of column is it in your list?

    Also, how are you getting the information you are displaying in your screenshot now?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 936 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 375 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 330 Super User 2025 Season 2

Last 30 days Overall leaderboard
Loading started
Loading complete