cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SamGibbs
Helper III
Helper III

Person picker field not saving to SharePoint

I have a simple form that includes a person picker field. The form is in 'new' mode.

 

In the person picker combo box I have set the default selected items to

 

Office365Users.SearchUser({searchTerm:HoD_email_hidden.Text})

 

HoD_email_hidden is a text input control that generates user ID numbers base on a formula.

 

The person picker correctly seems to select the required person in the person picker, but it doesn't save to sharepoint when the form is submitted.

 

When I remove the default select items it then submits correctly, but I am trying to make it so that the right person is selected automatically. Is there a way to make this work?

1 ACCEPTED SOLUTION

Accepted Solutions
SamGibbs
Helper III
Helper III

I have found a slight work around:

 

'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims:Concatenate("i:0#.f|membership|",HoD_email_hidden.Text,"@email.uk"),
DisplayName:User().FullName,
//display name is set to current user, however the correct email is being submitted to sharepoint
Email:Concatenate(HoD_email_hidden.Text,"@email.uk")

 

The only slight issue is that I can't seem to get the display name to show correctly. This is worked around as once it is auto-selecting it doesn't need to be on screen so I have hidden it.

 

However, if there is a better way I would still be interested!

View solution in original post

3 REPLIES 3
SamGibbs
Helper III
Helper III

I have found a slight work around:

 

'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims:Concatenate("i:0#.f|membership|",HoD_email_hidden.Text,"@email.uk"),
DisplayName:User().FullName,
//display name is set to current user, however the correct email is being submitted to sharepoint
Email:Concatenate(HoD_email_hidden.Text,"@email.uk")

 

The only slight issue is that I can't seem to get the display name to show correctly. This is worked around as once it is auto-selecting it doesn't need to be on screen so I have hidden it.

 

However, if there is a better way I would still be interested!

v-albai-msft
Community Support
Community Support

Hi @SamGibbs ,

Seems the HoD_email_hidden shows the DisplayName of user.

If so, you can try this formula on DefaultSelectedItems property:

 

{
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
DisplayName:LookUp(Office365Users.SearchUser({top:999}),DisplayName=HoD_email_hidden.Text).DisplayName,
Claims:"i:0#.f|membership|" & Lower(LookUp(Office365Users.SearchUser({top:999}),DisplayName=HoD_email_hidden.Text).Mail),
Department:"",
Email:LookUp(Office365Users.SearchUser({top:999}),DisplayName=HoD_email_hidden.Text).Mail,
JobTitle:"",
Picture:""
}

 

Notes:

1. You should pay attention to the uppercase and lowercase of the HoD_email_hidden value, space between displayName will also get a no match result. 

2. If HoD_email_hidden returns other property like ID, you need to edit formula to meet your own requirement.

Best regards,

Allen

Hi, thanks for responding. The 'HoD_email_hidden' is a using an if statement to find the correct ID number for the relevant user. This information is not set up within our office 365 users list. Plus we have well over 10000 entries in the users list so the formula desn't seem to work. Can it be adjusted to use the SearchUser({searchterm})? I tried but it didnt seem to work.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Check out the New Ideas Site

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (4,755)