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:Sharepoint ListSharepoint ListPowerappPowerapp

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
Highlighted
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
Highlighted
Helper III
Helper III

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?

 

Highlighted
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?

Highlighted
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.

Highlighted
Helper III
Helper III

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?

Highlighted
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.

Highlighted
Helper III
Helper III

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?

Highlighted
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.

Highlighted
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
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,771)