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

Unable to set People Picker

Hello,

 

I'm currently building an app that uses lookups with data held in a SharePoint list. In this instance a user wil complete a new form and at the beginning will enter a contract number, this number is then used to pre populate the form with as much data as possible. It works fine for all the text fields and drop downs - but the people pickers remain empty.

My formula is as follows (on the fields default property):

If(txt_New_ContractNumber.Text exactin col_CurrentContracts.'Contract Number',
    	{DisplayName: LookUp(col_CurrentContracts, 'Contract Number'=txt_New_ContractNumber.Text, 'Project Manager'.DisplayName),
      	Claims: LookUp(col_CurrentContracts, 'Contract Number'=txt_New_ContractNumber.Text, 'Project Manager'.Claims)
      	})

I have tested to see if what is brought back by just using the people picker is different to what is in the SharePoint list but it appears the same. I have read various articles and forum posts regarding this issue and i'm lead to believe that I only need to enter the DisplayName and Claims fields - I assume I am missing something.

Any help would be appreciated, thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Unable to set People Picker

Hi @Weblin ,

Do you want to auto-populate a Person field in your Edit form based on the entered contract number?

Do you put your If formula within the Default property of the ComboBox within the Person field data card in your Edit form?

 

Based on the issue that you provided, I think there is something issue with your operation. If you want to set a default value within the ComboBox which is connected to Person field in a SP list, please type your formula within the DefaultSelectedItems property of the person ComboBox  rather than within the Default property.

 

On your side, please consider set the the DefaultSelectedItems property of the ComboBox  within your Person field data card in your Edit form to following:

If(
    EditForm1.Mode = FormMode.New && txt_New_ContractNumber.Text exactin col_CurrentContracts.'Contract Number',
    { 
      Claims: "i:0#.f|membership|" & Lower(LookUp(col_CurrentContracts, 'Contract Number' = txt_New_ContractNumber.Text, 'Project Manager'.Email)),
      DisplayName: LookUp(col_CurrentContracts, 'Contract Number' = txt_New_ContractNumber.Text, 'Project Manager'.DisplayName),
      Email: LookUp(col_CurrentContracts, 'Contract Number' = txt_New_ContractNumber.Text, 'Project Manager'.Email),
      Department: "",
      JobTitle: "", 
      Picture: ""
   },
   Parent.Default
)

or

If(
    EditForm1.Mode = FormMode.New && txt_New_ContractNumber.Text exactin col_CurrentContracts.'Contract Number',
    { 
      Claims: "i:0#.f|membership|" & Lower(LookUp(col_CurrentContracts, 'Contract Number' = txt_New_ContractNumber.Text, 'Project Manager'.Email)),
      DisplayName: LookUp(col_CurrentContracts, 'Contract Number' = txt_New_ContractNumber.Text, 'Project Manager'.DisplayName)
    },
    Parent.Default
)

 

Please check and see if my response within the following thread would help in your scenario:

https://powerusers.microsoft.com/t5/General-Discussion/How-to-set-a-defaul-value-for-a-person-fields...

 

Best regards,

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

View solution in original post

4 REPLIES 4
MichelH
Level 8

Re: Unable to set People Picker

Possible the format for the claims is not what is expected.

Should be something like this:

{

DisplayName: User().FullName,

Claims: "i:0#.f|membership|" & User().Email

}

Weblin
Level: Powered On

Re: Unable to set People Picker

The formatting appears to be correct, I recieve no errors.

 

However I have checked to see what formats are returned from the SharePoint column for each, Project Manager.DisplayName/Claims and they are identical to what the people picker has if the project manager is selected manually.

Community Support Team
Community Support Team

Re: Unable to set People Picker

Hi @Weblin ,

Do you want to auto-populate a Person field in your Edit form based on the entered contract number?

Do you put your If formula within the Default property of the ComboBox within the Person field data card in your Edit form?

 

Based on the issue that you provided, I think there is something issue with your operation. If you want to set a default value within the ComboBox which is connected to Person field in a SP list, please type your formula within the DefaultSelectedItems property of the person ComboBox  rather than within the Default property.

 

On your side, please consider set the the DefaultSelectedItems property of the ComboBox  within your Person field data card in your Edit form to following:

If(
    EditForm1.Mode = FormMode.New && txt_New_ContractNumber.Text exactin col_CurrentContracts.'Contract Number',
    { 
      Claims: "i:0#.f|membership|" & Lower(LookUp(col_CurrentContracts, 'Contract Number' = txt_New_ContractNumber.Text, 'Project Manager'.Email)),
      DisplayName: LookUp(col_CurrentContracts, 'Contract Number' = txt_New_ContractNumber.Text, 'Project Manager'.DisplayName),
      Email: LookUp(col_CurrentContracts, 'Contract Number' = txt_New_ContractNumber.Text, 'Project Manager'.Email),
      Department: "",
      JobTitle: "", 
      Picture: ""
   },
   Parent.Default
)

or

If(
    EditForm1.Mode = FormMode.New && txt_New_ContractNumber.Text exactin col_CurrentContracts.'Contract Number',
    { 
      Claims: "i:0#.f|membership|" & Lower(LookUp(col_CurrentContracts, 'Contract Number' = txt_New_ContractNumber.Text, 'Project Manager'.Email)),
      DisplayName: LookUp(col_CurrentContracts, 'Contract Number' = txt_New_ContractNumber.Text, 'Project Manager'.DisplayName)
    },
    Parent.Default
)

 

Please check and see if my response within the following thread would help in your scenario:

https://powerusers.microsoft.com/t5/General-Discussion/How-to-set-a-defaul-value-for-a-person-fields...

 

Best regards,

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

View solution in original post

Weblin
Level: Powered On

Re: Unable to set People Picker

Thanks Kris, turns out I just needed to move my If statement from Default to DefaultSelectedItems as you mentioned.

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 (4,873)