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 / Updating form field wi...
Power Apps
Unanswered

Updating form field with button

(0) ShareShare
ReportReport
Posted on by

Hi,

 

I am a PowerApps beginner and trying to create an app a somehow basic app.

 

I am using a SharePoint list as data source, and I am using a EditForm. I want to be able to update fields when I click a button (onSelect) and save it to SharePoint. I have seen several examples, though I don't seem to get it to work.

 

I am looking for:

 

  1. Have a button that updates the "Issue Status " field to "Resolved" and sets another field "Resolution date" with the current date;
  2. Another button labeled "Take Ownership" that updates the field "Owner" to the current user (type Person in SharePoint).

 

At this point I haven't even been able to update a simple basic text field with new text like "Test" at a click of a button.

 

I've seen examples that use the function PATCH, others that create a global variable and set the dropdown list to the variable, and a few other solutions, though I am not able to either update the field on the screen or update it on sharepoint. Any help would be appreciated.

 

Thanks

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,991 Moderator on at

    @FlyingTuga 

    Here's my take on your two questions:

     

    1.  Put this code in the OnSelect property of a button within your form to PATCH the status and resolution date.  My assumption here is Issue Status is a Choices field in SharePoint.  Replace the datasource name with your own. 

     

    Patch(
     your_datasource_name,
     ID = ThisItem.ID,
     {'Issue Status': {Value: "Resolved"}, 'Resolution date': Today()}
    );

     

    2.  Put this code in the OnSelect property of a button within your form to PATCH the current user into the Owner field.   Replace the datasource name with your own.

     

    Patch(
     your_datasource_name,
     ID = ThisItem.ID,
     {
     Owner: 
     {
     '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     Claims:"i:0#.f|membership|" & User().Email,
     Department:"",
     DisplayName: User().FullName,
     Email: User().Email,
     JobTitle:"",
     Picture:""
     }
     }
    );

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you @mdevaney, this worked for me with a tweak

     

    I had to change slightly the code 

     

    Patch(
    IssuesTest,
    First(Filter(IssuesTest,ID=BrowseGallery1.Selected.ID)),
    {'Status':{Value:"Resolved"},'Resolved on':Today()}
    );

     

     

    The ThisItem.ID was not working, I guess because the button is not within the form. Am I doing something wrong? I don't seem to be able to add a button within the form. I've also copied the First(Filter( from another post. Is this the most clean way to do it?

     

    Thanks

     
    Annotation 2020-04-19 213327.png

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard