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 / How to update Sharepoi...
Power Apps
Answered

How to update Sharepoint list item when a form button is clicked

(2) ShareShare
ReportReport
Posted on by 10
Hello! I currently have a SharePoint list set up and a form within my app that the user will fill out and it updates that list when they’re finished. I have created a button, but I cannot get it to do what I am wanting. The goal is for the user to press the button and it will change one column from “open” to “closed” (which I have been able to successfully do, but I also want it to automatically update a specific column in the list entry with the name of the user that is signed in. I tried using a patch function but am getting an error.
What I have so far is
 
Patch(NEMO, BrowseGallery3.Selected,{'Maximo Status':{Value:"Closed"}})
 
that successfully does the first thing I am wanting, but I cannot figure out how to get the user’s name to automatically update in the list. Any help is greatly appreciated!
Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,362 Super User 2025 Season 2 on at
    Hi
     
    Let's assume that the column is in the same list, as you dont say for sure.
     
    I would recommend that you save their Email too, or use a Person column. or use an Email and a Name Column
     
    But here is how you can get their name, now you have saved their name
     
    Patch(NEMO, BrowseGallery3.Selected,
           {
              'Maximo Status':{Value:"Closed"},
              'Name Column': User().DisplayName
           }
    )
     
  • Suggested answer
    Danielmp599 Profile Picture
    31 on at

    Hello, I hope you are well.

    I have a question about how you want to store user information. Here are two possible solutions:

    The first: If you have an application where you want to save the user who made the last change, you can take advantage of a feature in SharePoint lists called “Modified by.” This column stores the account of the last user who made any changes.

    The second: If, on the other hand, you need to store the change manually, meaning you enter the last user who made the change, you can have a field in your list of type “Person.” In the form, when saving and/or updating, you should accompany it with the following code:

     
    Patch(NEMO, BrowseGallery3.Selected,
           {
              'Maximo Status':{Value:"Closed"},
              User: 
                   {
                       'odata.type': "Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
                       Claims: "i:0#.f|membership|" & Lower(combobox_user.Selected.Email),
                       Department: combobox_user.Selected.Department,
                       DisplayName: combobox_user.Selected.DisplayName,
                       Email: combobox_user.Selected.Email,
                       JobTitle: combobox_user.Selected.JobTitle,
                       Picture: combobox_user.Selected.Picture
                    }      
           }
    )
     

    Where “combobox_user” is the “person” type element that appears by default when you add your form.

    It would be great if you could share more details about what you want to do. Likewise, if you have any questions or comments, feel free to write to me.

     
  • CU09091535-0 Profile Picture
    10 on at
    @FLMike, sorry for the confusion. The columns are within the same list. The column that I am trying patch the name into is titled "Verified Complete By." This is the code that I have entered for OnSelect, but it is giving me two errors:
     
    The code I have entered:
    Patch(NEMO, BrowseGallery3.Selected,{'Maximo Status':{Value:"Closed"},'Verified Complete By': User().FullName})
     
    "The type of this argument 'VerifiedCompleteBy' does not match the expected type 'Record'. Found type 'Text'.
    "The function 'Patch' has some invalid arguments."
     
  • Verified answer
    Danielmp599 Profile Picture
    31 on at
    The error you are receiving is because the data type you are storing is not the same. You can try changing the data type of ‘Verified Complete By’ in your list to ‘Text’. Another solution is to enter the following code:
    Patch(NEMO, BrowseGallery3.Selected,
      {
        'Maximo Status':{Value:"Closed"},
        'Verified Complete By':
          {
            'odata.type': "Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
            Claims: "i:0#.f|membership|" & Lower(User().Email),
            Department: User().Email,
            DisplayName: User().FullName,
            Email: User().Email,
            JobTitle: User().Email,
            Picture: User().Image
        }
    )
    Just copy and paste

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 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard