cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Edit a Person or Group item in a Sharepoint List using Patch (NOT add a new row)

Hey,

 

I'm pretty new to powerapps and have been struggling with this app for some time now, I had found messages in this forum that told me you can't just Patch a Person or Group based a text box because a Person or Group column contains the person's Display Name, Email, Job Title, etc. So I was hoping that I could select a Person or Group from a Gallery and have that selection Patch the item. I don't want to create a new item, I just want to change the current item's owner.

 

Here is my Sharepoint List:Powerapps Help 2.PNGSharepoint ListPowerapps Help 1.PNGPowerapp

It just has 2 items in it, Project A with one owner. Project B with another owner. The Project Owner Column is a Person or Group type.                                                                                                                                                            Here is my Powerapp. It is very basic right now. So someone can type the name of a project in the box and it will list the projects with the Current Owner and the Last Modified Time. This is just a Text Input box with a Gallery. I want to change who the owner of a Project is. So below this first Gallery, there is another Text Input and Gallery where someone will type the name of someone and see a list of Owners. They have to select one of the owners, then click the save button on the project that they wish to change the owner for. So here is the issue: That little red x above my save button says "Invalid Argument Type, expecting a Record Value, but of a different schema". The code I am currently using is:

On Select

 

Patch('Project Owner Reassign', ThisItem, {Owner: NewOwnerGallery.Selected}) 

 

Any help on why I am getting that error would be great. Thank You!

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Re: Edit a Person or Group item in a Sharepoint List using Patch (NOT add a new row)

I figured it out! This was the original equation:

Patch('Project Owner Reassign', ThisItem, {Owner: NewOwnerGallery.Selected})

This was trying to patch the Owner column of the First Gallery with an entire item (All the Columns) in the New Owner Gallery. 

 

All I had to do was add the red part to the equation:

Patch('Project Owner Reassign', ThisItem, {Owner: NewOwnerGallery.Selected.Owner})

This changes it because now The first Gallery's Column Owner, with the Owner column of the New Owner Gallery. Now the patch works fine!

View solution in original post

8 REPLIES 8
Pat_Wickramage
Level: Powered On

Re: Edit a Person or Group item in a Sharepoint List using Patch (NOT add a new row)

Hi @Anonymous

 

Quick question, are you working with two different gallaries?

One for current owner info & another for new owner info which needs to patched to the current user gallery?

 

Anonymous
Not applicable

Re: Edit a Person or Group item in a Sharepoint List using Patch (NOT add a new row)

Hey @Pat_Wickramage,

 

Yes, they are two different galleries, the current owner, and new owner galleries. Right now they are pulling from the same Sharepoint List, but this is just my test Powerapp, so I think that when I make the real one I would like them to pull from to different lists. I think that I will have a Members Sharepoint list. I hope that won't affect anything. The lists will be from the same organization so the Person or Group data will be the same in both lists. Any thoughts?

Anonymous
Not applicable

Re: Edit a Person or Group item in a Sharepoint List using Patch (NOT add a new row)

Oh sorry @Pat_Wickramage,

 

I don't think I answered your question clearly. Yes, the new user gallery is supposed to patch the item on the current user gallery.

Pat_Wickramage
Level: Powered On

Re: Edit a Person or Group item in a Sharepoint List using Patch (NOT add a new row)

Ok.

If I understand correctly.

Gallery 1 is for viewing data.

Gallery 2 is for editing the same data that Gallery 1 is showing.

Yes?

Anonymous
Not applicable

Re: Edit a Person or Group item in a Sharepoint List using Patch (NOT add a new row)

@Pat_Wickramage you have it exactly right.

Pat_Wickramage
Level: Powered On

Re: Edit a Person or Group item in a Sharepoint List using Patch (NOT add a new row)

So when you click on edit on one Gallery 1, it opens up Gallery 2 to edit the data?

 

And your equation is in which Gallery is it?

Anonymous
Not applicable

Re: Edit a Person or Group item in a Sharepoint List using Patch (NOT add a new row)

Yes, when you click edit it opens the new owner Gallery (Gallery 2). The Current Owner Gallery (Gallery 1) has the save button and the equation to patch the data.

Anonymous
Not applicable

Re: Edit a Person or Group item in a Sharepoint List using Patch (NOT add a new row)

I figured it out! This was the original equation:

Patch('Project Owner Reassign', ThisItem, {Owner: NewOwnerGallery.Selected})

This was trying to patch the Owner column of the First Gallery with an entire item (All the Columns) in the New Owner Gallery. 

 

All I had to do was add the red part to the equation:

Patch('Project Owner Reassign', ThisItem, {Owner: NewOwnerGallery.Selected.Owner})

This changes it because now The first Gallery's Column Owner, with the Owner column of the New Owner Gallery. Now the patch works fine!

View solution in original post

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,109)