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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Power App change value...
Power Apps
Unanswered

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

(0) ShareShare
ReportReport
Posted on 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)
  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @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?

  • etharAli Profile Picture
    40 on at

    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"

  • etharAli Profile Picture
    40 on at

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

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @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 at

    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'))

  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @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!

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 793 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 333 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard