cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AJ13
Level: Powered On

Converting edit text control to people picker

Hi, 

 

I have a an app working off a sharepoint list. I am trying to change the text type field as a people picker in powerapps. 

I really don't want to mess with the sharepoint list structure because then i will have to re-do the app screens and forms according to the new list structure.

Any help will be appreciated. Thanks.

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Community Support Team
Community Support Team

Re: Converting edit text control to people picker

Hi @AJ13,

 

Would you please tell us what is the column type for this column in SharePoint list? Is it a Person and Group column, but you want to update this Person field with a text control in PowerApps? 

 

First of all, please understand that by default, by adding this Person field inside the Form control, it will be added as a dropdown control automantically and you can search and select person here, update the record with SubmitForm function. This is the normal way and easiest way to update this field for SharePoint.

 

But if you want to use text control to update Person field instead, then you need to use Patch function instead of SubmitForm.

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|mona@wiXXXX.onmicrosoft.com",
    Department:"",
   DisplayName:"Mona Li",
         Email:"Mona@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|mona@wiXXXX.onmicrosoft.com",

And the DisplayName and Email field, as shown below:

 

 DisplayName:"Mona Li",
         Email:"Mona@wiXXXX.onmicrosoft.com",

 So at least you will need 3 text controls to hold the information for Claims/DisplayName/Email.

 

 

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:"Mona Li", Email:"Mona@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:"Mona Li", Email:"Mona@testing.com", JobTitle:"", Picture:""}, { Claims:"i:0#.f|membership|test2@testing.com", Department:"", DisplayName:"Test2", Email:"Test2@testing.com", JobTitle:"", Picture:""}) } )

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
rebeccas
Level 10

Re: Converting edit text control to people picker

A people picker is a Combo Box, for it to work you have to have choices. What is the data you want it to pull from?

 

Can you add a people field to your SPList instead of the text box or will that not work for your need?

7 REPLIES 7
Community Support Team
Community Support Team

Re: Converting edit text control to people picker

Hi @AJ13,

 

Would you please tell us what is the column type for this column in SharePoint list? Is it a Person and Group column, but you want to update this Person field with a text control in PowerApps? 

 

First of all, please understand that by default, by adding this Person field inside the Form control, it will be added as a dropdown control automantically and you can search and select person here, update the record with SubmitForm function. This is the normal way and easiest way to update this field for SharePoint.

 

But if you want to use text control to update Person field instead, then you need to use Patch function instead of SubmitForm.

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|mona@wiXXXX.onmicrosoft.com",
    Department:"",
   DisplayName:"Mona Li",
         Email:"Mona@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|mona@wiXXXX.onmicrosoft.com",

And the DisplayName and Email field, as shown below:

 

 DisplayName:"Mona Li",
         Email:"Mona@wiXXXX.onmicrosoft.com",

 So at least you will need 3 text controls to hold the information for Claims/DisplayName/Email.

 

 

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:"Mona Li", Email:"Mona@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:"Mona Li", Email:"Mona@testing.com", JobTitle:"", Picture:""}, { Claims:"i:0#.f|membership|test2@testing.com", Department:"", DisplayName:"Test2", Email:"Test2@testing.com", JobTitle:"", Picture:""}) } )

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
AJ13
Level: Powered On

Re: Converting edit text control to people picker

Thank you Mona for the reply.

My SP List is text type and I need the powerapps to be a person type. I think what you are saying is the other was round. 

AJ13
Level: Powered On

Re: Converting edit text control to people picker

@v-monli-msft Please help me with it. Have run out of ideas.

rebeccas
Level 10

Re: Converting edit text control to people picker

A people picker is a Combo Box, for it to work you have to have choices. What is the data you want it to pull from?

 

Can you add a people field to your SPList instead of the text box or will that not work for your need?

AJ13
Level: Powered On

Re: Converting edit text control to people picker

Unfortunately I cannot use a person field in SP List. It has to be a text field.

 

I want the powerapps people picker to be able to lookup from entire population in my organization and then Save the display name or email to the text field in SP List. Also take the Display name/email id and show the corresponding Person in Powerapps while displaying the record.

rebeccas
Level 10

Re: Converting edit text control to people picker

Okay...so put in a people picker outside the form or in a customized card (you will still have to direct it where to look so tie to Outlook or whatever you are using to let it find the people in your organization).

 

Then for the part that puts the data to the SP List put the card there and then on the DataCardValue make the default =PeoplePicker.Selected.DisplayName (or email or whatever you want to put)...just hide the card so nobody sees it but it will store the data for you as a text field. 

AJ13
Level: Powered On

Re: Converting edit text control to people picker

@rebeccas, I get it now. Should be able to figure it out.