Showing results for 
Search instead for 
Did you mean: 
Post Prodigy
Post Prodigy

UpdateContext and Visibility

I have a couple questions. I have built a Time Off Request app for our employees. I made a PendingRequests Screen where the managers login to approve or deny requests. I used UpdateContext to update the Status column in my Excel depending of if they click Approve or Deny but nothing is populated in my Excel. Here is my OnSelect statement:


Office365.SendEmail(Email,"Time Off Request","Your time off request has been approved.");



Second question is on Visibility, I have 3 screens: PendingRequests, ApprovedRequests, and DeniedRequests. So once a request is Approved or Denied, I want the request to only be visible on the appropriate Screen. So on Visible statement I tried:


If (Status = "Approved")


but it did not work, any help would be appreciated. Thank you!


Accepted Solutions
Responsive Resident
Responsive Resident

If you have a dropdown


"Approved", Colour,

"Rejected", Colour,



If you have a Text Column as source


"Approved", Colour,

"Rejected", Colour,





View solution in original post


Hi thunter,


UpdateContext() is used to set a temporary variable on the current screen, that is local to that screen.  It will only update the variable in the PowerApps session, not update the source, (which in this case I'm assuming to be your Excel sheet).


To update the source, you need to either use an Edit form and a Submit() function, or a Patch() function.


If you use an Edit form, you can then also use the OnSuccess: property for the form to send your email, this makes sure it only sends the email if the update succeeds.


Assuming for now you're not using a form, your Patch() statement would look something like this;

Patch(ExcelSource, RowToUpdate, {Status: "Approved"})

where RowToUpdate is a function that returns the specific row you want to update - this may be a LookUp(), or, in the context of a Gallery item, assuming the button you're pressing is inside the Gallery item, you can just use ThisItem


As for the screens, you can't control whether a screen is 'visible' or not - only controls and elements on the screen carry this property.  If you're using a Gallery or something similar to display data on the screen, then you would typically just filter the data according to the Status for that Gallery on that screen - so a Gallery displaying data on your PendingRequests screen might have its Items: property set to;

Filter(ExcelSource, Status="Pending")

whereas on your ApprovedRequests screen the Gallery showing the data for that screen might have its Items: property set to;

Filter(ExcelSource, Status="Approved")


Not sure if this helps you, perhaps you can provide some screenshots for additional context to help determine the best solution?


Kind regards,



Thanks for your feedback. Yes, you are correct, I want to make the Gallery visible on the ApprovedRequests screen if the Status is Approved and visible on the DeniedRequests if the Status is Denied. I also tried to use UpdateContext({Status:"Approved"}) but it doesnt work. Is that where I would use the Filter command as you stated?

Hi thunter,


Would it be possible to post some screenshots so I can get a better look at what we're dealing with? 🙂


Kind regards,


Super User
Super User

You need to Patch the datasouce to actually change it, (Lookup Patch function in PowerApps).  UpdateContext just creates a temporary variable. In your case, you can use UpdateContext() to create a variable and set it to either true or false since the Visible property must equate to either true or false. So in the OnSelect property of the button the UpdateContext({approved:true}), Set the Visible property to "approved" (without the quotes).  If you want the Visible property of a form, control, label, etc. to hide when the screen opens, set the OnVisible property of the screen to UpdateContext({approved:false}).  Hope this helps.

I read the document on the Patch function and here is what I tried:

Patch(PendingRequest_Table, Status, "Denied")

PendingRequest_Table is a Sheet in my Excel

Status is the Column I want updated

"Denied" is what I want to populate the column with

Hi thunter,


Thanks for the screenshot 🙂


Your formula should work, assuming it's on the OnSelect: property of the Tick icon and the Tick icon is inside a gallery row and not on top of it or elsewhere in the screen hierarchy.  I also assume the data in the Gallery row is from the PendingRequestsTable?


What is the error on the Tick icon?


Kind regards,



The format of your Patch() statement seems to have changed from the first pic.....but I see you have the cross selected now instead of the tick.


The correct format is 

Patch(source, record, {column: "value"})

can you update your Patch statement to 

Patch(PendingRequest_Table, ThisItem, {Status: "Denied"})

for the cross and 

Patch(PendingRequest_Table, ThisItem, {Status: "Approved"})

for the tick and then show what the error is?


Thanks 🙂




Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,271)