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 Apps
Answered

Updating a field

(0) ShareShare
ReportReport
Posted on by 17

Hi,

 

I'm struggling with the logic behind updating fields on power apps. 

 

I can get what I'm trying to do work when in the Edit Form but I want to make this work on the Detail screen.

I'm trying to update the status field to cancelled by using updateContext. 

 

Why isn't it letting me update the field in the details screen?

 

The button OnSelect is set to Update Context( { varStatus: "Cancelled"} )

A text input is set to varStatus

 

But then I'm not sure how to update this within the Details view.

 

Capture.PNG

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @globe11123 

    You mention that you are using UpdateContext and that is working in your Edit Form.

    I am assuming that your Detail view is on another screen.

    If that is the case then you need to realize that UpdateContext is a function to set local screen variables only.  If you need that variable to be global (across screens), then consider using a global variable instead:

    Set(varStatus. "Cancelled")

     

    Then you can reference the variable anywhere in your app.

     

    I hope the assumption was correct and that this is helpful for you.

     

  • globe11123 Profile Picture
    17 on at

    @RandyHayes 

     

    Cancel.PNG

    I've updated the button code, on the Details Form which updates the text field that is set to varStatus.

     

    But as you can see on the Status label it still says approved?

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

    @globe11123 

    Did you actually change the formula on that field in your view form?

  • globe11123 Profile Picture
    17 on at

    Which formula am I meant to change? 

     

    This is where power apps is very confusing.

  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @globe11123 

    The view form is designed to be read only.  That is why you are having problems trying to make it do something it isn't designed to do.  That being said, you can work around it by using the information that selected the record in the view form to patch the underlying datasource.  This is what @RandyHayes  is trying to tell you.  The syntax for this is

     

     

     

    Patch(datasource, Lookup(datasource, ID = Gallery1.Selected.ID), {FieldToBeModified:"Approved"})

     

     

     

    The datasource would be the one in your gallery.  The FieldToBeModifed,, likely Status, is the field name for Approved.  You may need to refresh the datasource after the patch for the change to be visible in your view form.  

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

    @globe11123 

    So for your view form, you'll want to unlock that data field and set the default to your variable.

    That should show you the correct value.

    Although keep in mind, this is display ONLY.  You will not be impacting the actual record, only the display of it.

    As mentioned by @Drrickryp you'll want to implement a different formula if you want to impact the actual data.

     

    Keep at it...the confusion will go away after a while!

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 360 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 325

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard