cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
abd3127
Level 8

Saving data from powerapps to SP lists person/Group column

Hello ,

i need to save the user info in Person/Groups column of my SP list.

I am selecting the data from a Drop down list.

When i do "DD.selected.value' it gives mee error saying that it needs a record to save.

How can i do this??

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Saving data from powerapps to SP lists person/Group column

Hi @abd3127,

 

As the Person or group column type in SharePoint list is considered as a lookup field, we should patch the whole record of the person to this field, and depends on whether you have the Multi-Selection enabled, the schema varies.

I will share an example here.

1. Patch to the Person or group field, which only allows single value.

The record of single person would contain the following values:

 

{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
        Claims:"i:0#.f|membership|michael@wiXXXX.onmicrosoft.com",
    Department:"",
   DisplayName:"Michael Shao",
         Email:"Michael@wiXXXX.onmicrosoft.com",
      JobTitle:"",
       Picture:""
   }

Each value should match the pre-defined value stored under SharePoint data source, if you have no idea for the Department, JobTitle or Picture field, you may just leave it as "".

 

 

Fields need to be entered:

The Value for this field is fixed.

'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",

for Claims field,you should modify the end of this field to match the person Email:

Claims:"i:0#.f|membership|michael@wiXXXX.onmicrosoft.com",

And the DisplayName and Email field, as shown below:

 

 DisplayName:"Michael Shao",
         Email:"Michael@wiXXXX.onmicrosoft.com",

 

To patch a person to the Person or group field as a new record, the formula should be(Title is a required field when creating new records, so whenever a new record is created, all the required field should be get involved in the patch 3rd parameter.):

 

Patch(Patchtesting,
Defaults(Patchtesting), { Title:"SinglePerson", Person: {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser", Claims:"i:0#.f|membership|michael@testing.com", Department:"", DisplayName:"Michael Shao", Email:"Michael@testing.com", JobTitle:"", Picture:"" }})

 

For Person or group Field which have Multiple selection enabled, the structure is a little difference.

For example, the following code would work to patch the MultValue person field:

Patch(Patchtesting,Defaults(Patchtesting),
{ Title:"MultiPerson",
Multi_x002d_Person: Table( { Claims:"i:0#.f|membership|michael@testing.com", Department:"IT", DisplayName:"Michael Shao", Email:"Michael@testing.com", JobTitle:"", Picture:""}, { Claims:"i:0#.f|membership|test2@testing.com", Department:"", DisplayName:"Test2", Email:"Test2@testing.com", JobTitle:"", Picture:""}) } )

Image reference:

47.PNG

48.PNG

46.PNG

 

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
16 REPLIES 16
Community Support Team
Community Support Team

Re: Saving data from powerapps to SP lists person/Group column

Hi @abd3127,

 

As the Person or group column type in SharePoint list is considered as a lookup field, we should patch the whole record of the person to this field, and depends on whether you have the Multi-Selection enabled, the schema varies.

I will share an example here.

1. Patch to the Person or group field, which only allows single value.

The record of single person would contain the following values:

 

{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
        Claims:"i:0#.f|membership|michael@wiXXXX.onmicrosoft.com",
    Department:"",
   DisplayName:"Michael Shao",
         Email:"Michael@wiXXXX.onmicrosoft.com",
      JobTitle:"",
       Picture:""
   }

Each value should match the pre-defined value stored under SharePoint data source, if you have no idea for the Department, JobTitle or Picture field, you may just leave it as "".

 

 

Fields need to be entered:

The Value for this field is fixed.

'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",

for Claims field,you should modify the end of this field to match the person Email:

Claims:"i:0#.f|membership|michael@wiXXXX.onmicrosoft.com",

And the DisplayName and Email field, as shown below:

 

 DisplayName:"Michael Shao",
         Email:"Michael@wiXXXX.onmicrosoft.com",

 

To patch a person to the Person or group field as a new record, the formula should be(Title is a required field when creating new records, so whenever a new record is created, all the required field should be get involved in the patch 3rd parameter.):

 

Patch(Patchtesting,
Defaults(Patchtesting), { Title:"SinglePerson", Person: {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser", Claims:"i:0#.f|membership|michael@testing.com", Department:"", DisplayName:"Michael Shao", Email:"Michael@testing.com", JobTitle:"", Picture:"" }})

 

For Person or group Field which have Multiple selection enabled, the structure is a little difference.

For example, the following code would work to patch the MultValue person field:

Patch(Patchtesting,Defaults(Patchtesting),
{ Title:"MultiPerson",
Multi_x002d_Person: Table( { Claims:"i:0#.f|membership|michael@testing.com", Department:"IT", DisplayName:"Michael Shao", Email:"Michael@testing.com", JobTitle:"", Picture:""}, { Claims:"i:0#.f|membership|test2@testing.com", Department:"", DisplayName:"Test2", Email:"Test2@testing.com", JobTitle:"", Picture:""}) } )

Image reference:

47.PNG

48.PNG

46.PNG

 

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
bloodoff
Level 8

Re: Saving data from powerapps to SP lists person/Group column

@v-micsh-msft

Do you happen to know how to clear the Person column?

This code below doesn't work (while a similar code works for a regular lookup):

{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
        Claims:"",
    Department:"",
   DisplayName:"",
         Email:"",
      JobTitle:"",
       Picture:""
   }

 

LogesFrancis
Level: Powered On

Re: Saving data from powerapps to SP lists person/Group column

Bloodoff, did you end up getting this to work. i am after a similar result where i want to use the selected user details and patch them over.

bloodoff
Level 8

Re: Saving data from powerapps to SP lists person/Group column

@LogesFrancis nope, it's a limitation currently but there is an "idea" that covers both numeric and person fields. Please make sure to upvote it.

https://powerusers.microsoft.com/t5/PowerApps-Ideas/Allow-us-to-update-a-numeric-field-to-null-blank...

 

LogesFrancis
Level: Powered On

Re: Saving data from powerapps to SP lists person/Group column

thanks, i dont suppose you know how to patch the selected user in a drop down.

 

I have

Column: {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
                       Claims:"i:0#.f|membership|XXXX@XXXX.com",
                   Department:"",
                  DisplayName:"XXXX",
                        Email:"XXXX@XXXXX.com",
                     JobTitle:"",
                      Picture:""

 

where X = selected value. Ive tried user() and "" but no luck.

bloodoff
Level 8

Re: Saving data from powerapps to SP lists person/Group column

It is supposed to work and I have it working just fine. Make sure every bracket is in a proper place.

{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims:"i:0#.f|membership|flast@contoso.com",
Department:"",
DisplayName:"First Last",
Email:"flast@contoso.com",
JobTitle:"",
Picture:""}

 

I have an app where this code works too:

{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",Claims:Concatenate("i:0#.f|membership|",Office365Users.Manager(Email.Email).Mail),Department:"",DisplayNameffice365Users.Manager(Email.Email).DisplayName, Emailffice365Users.Manager(Email.Email).Mail, JobTitle:"", Picture:""}

 

tianaranjo
Level 8

Re: Saving data from powerapps to SP lists person/Group column

@v-micsh-msft

 

I have been struggling with this for a couple of days.  For some reason, when I go to Patch, the column name (Employee_x0020_Name)  is not available.  

My DataCard is DataCard4, the property name is DataCardValue3.

Can you please tell me what I'm missing here?  

 

Thank you!

 

Patch(AppAdmins, Defaults(AppAdmins),
{Trying to put column name here:  
{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpanderUser",
Claims:"i:0#.f|membership|" & Lower(User().Email),
Department:"",
DisplayName: DataCardValue3.Selected.DisplayName,
Email:  DataCardValue3.Selected.Email,
JobTitle:".",
Picture:"."}});

LogesFrancis
Level: Powered On

Re: Saving data from powerapps to SP lists person/Group column

hiya make sure you include the title in the first field of patching ie Title:titledatacard1.Text,

 

what do you have in {Trying to put column name here:  ?

 

also you need to specify all the metadata of the emails ie Employee Name:{Claims: dcvemployeename.Selected.Claims, Department: dcvemployeename.Selected.Department, DisplayName: dcvemployeename.Selected.DisplayName, Email: dcvemployeename.Selected.Email, JobTitle: dcvemployeename.Selected.JobTitle, Picture: dcvemployeename.Selected.Picture, '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser"

Highlighted
JeremyDIV
Level: Powered On

Re: Saving data from powerapps to SP lists person/Group column

Does anyone else find this ridiculously complicated and counterintuitive for what should be a simple task?

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Top Community Contributors for September  2019

Top Community Contributors for September 2019 🎉🎉

Let's thank our top community contributors

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 229 members 5,657 guests
Please welcome our newest community members: