Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

How do I get my patch statement to update the selected item in a SharePoint form?

Like (1) ShareShare
ReportReport
Posted on 7 Aug 2024 23:23:47 by 279
I have a SharePoint Modern page with a couple of web parts. One is a list web part, and the other is an embed webpart to link the items on the list webpart to my Power App. This seems to be working just fine, but I also have a save button on the App that I need to use to update the items that is selected on the list webpart. After connecting the webparts, I am using <iframe src="http://apps.powerapps.com/play/mAppID?ID=[$ID]"></iframe> to pass the ID of the item selected to the power app.  The patch statement in the app I am trying to use to update a multi select people column in my SharePoint list looks like this...
 
Patch(
   myList,
	LookUp(
	  myList, ID = Value(Param("ID")),
	  {
	    myColumn: Table (
              {
		'odata.typr': "@Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
		Claims: User().Email,
		DisplayName: User().FullName,
		Department: "",
		Email: User().Email,
		JobTitle: "",
		Picture: ""	    
	      })
   	  }
      )
   );
 
 
This patch statement keeps creating new entries, rather than updating the item that has been selected in the list form. What am I missing here?
  • Verified answer
    Spawn10 Profile Picture
    Spawn10 279 on 08 Aug 2024 at 15:47:26
    How do I get my patch statement to update the selected item in a SharePoint form?
    Just found out that my format was wrong. My where clause was not closed before I started the operation. So this worked as planned...
    Patch(
       myList,
    	LookUp(
    	  myList, ID = Value(Param("ID"))),
    	  {
    	    myColumn: Table (
                  {
    		'odata.typr': "@Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
    		Claims: User().Email,
    		DisplayName: User().FullName,
    		Department: "",
    		Email: User().Email,
    		JobTitle: "",
    		Picture: ""	    
    	      })
       	  }
          
       );
     
  • WarrenBelz Profile Picture
    WarrenBelz 144,654 on 07 Aug 2024 at 23:49:40
    How do I get my patch statement to update the selected item in a SharePoint form?
    Firstly, you can do this
    Patch(
       myList,
       {
          ID: Value(Param("ID")),
          myColumn: 
          {
             Claims: "i:0#.f|membership|" & Lower(User().Email),
             DisplayName: User().FullName,
             Department: "",
             Email: User().Email,
             JobTitle: "",
             Picture: ""	    
          }
       }
    );
    however from your description of the issue, also put a Label on the screen with Value(Param("ID")) and see if the value is actually there.
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

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

End of Year Newsletter…

End of Year Community Newsletter…

Tuesday Tip #12 Start your Super User…

Welcome to a brand new series, Tuesday Tips…

Tuesday Tip #11 New Opportunities…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 144,654

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,440

Leaderboard
Loading started