Skip to main content

Notifications

Power Platform Community / Forums / Building Power Apps / How do I get my patch ...
Building Power Apps
Answered

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

Posted on by 277
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 277 on at
    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 140,749 on at
    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

Helpful resources

Quick Links

Welcome to the Power Platform…

We are thrilled to unveil the newly-launched Power Platform Communities!…

Community Update Sept 16…

Power Platform Community Update…

Welcome to the new Power Platform Community!…

We are excited to announce our new Copilot Cookbook Gallery in the Community…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 140,749

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,355

Leaderboard