cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

People picker Patch function - The specified user is invalid: Server Response: Specified user could not be found

I used this piece of patch code on another page in my app. Works perfectly fine.

For a similar person field I want to patch this piece of code, not sure why it throws this rather weird error.

Any ideas to where I'm going wrong?

 

Screenshot (44)_LI.jpg

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: People picker Patch function - The specified user is invalid: Server Response: Specified user could not be found

Hi @qfatima ,

 

Patch formula for person and group field should be something like:

{'@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:""
   }

 

You could have a look at below thread:

https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/Saving-data-from-powerapps-to-SP-li...

 

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.

View solution in original post

8 REPLIES 8
Highlighted
Dual Super User III
Dual Super User III

Re: People picker Patch function - The specified user is invalid: Server Response: Specified user could not be found

Hey @qfatima 

 

I see all the fields as empty, and as per the error, the person is not found. This means you have to pass correct details about the user/person. As a different approach to this, you can use the Choices() function to patch the result as:

If this is a multiselect person field

Patch(DataSource, First(Filter(DataSource, Col1 = "Value1")),{ Title:"Title Value", FieldServiceSME: Filter(Choices(DataSource.FieldServiceSME), DisplayName = "NametoSearch")})

If this is a single select person field.

Patch(DataSource, First(Filter(DataSource, Col1 = "Value1")),{ Title:"Title Value", FieldServiceSME: LookUp(Choices(DataSource.FieldServiceSME), DisplayName = "NametoSearch")})

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Highlighted
Frequent Visitor

Re: People picker Patch function - The specified user is invalid: Server Response: Specified user could not be found

I have the exact same piece of code (for the same SharePoint list, within the same app) for patching selected person(s) on a form to the SharePoint list. I also read other blogs where patching based on empty values is allowed. Couldn't yet figure out why this error on this page. 

 

Also, I checked your suggestion:

Patch('Bid Management_1', First(Filter('Bid Management_1',Title = EditRecord.Title)),
{
    Title:"FieldServicesSME",
    FieldServicesSME:
    Filter(Choices('Bid Management_1'.FieldServiceSME), DisplayName = NamePicker.Selected.DisplayName)})

Error attached - thanks!

 

Highlighted
Community Support
Community Support

Re: People picker Patch function - The specified user is invalid: Server Response: Specified user could not be found

Hi @qfatima ,

 

Did you mean that you want to leave this person and group field blank when patching items to SharePoint list? If so, then you just need to not include this field in Patch formula. Like:

Patch('Bid Management_1', First(Filter('Bid Management_1',Title = EditRecord.Title)),
{
    Title:"FieldServicesSME"}
)

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

Re: People picker Patch function - The specified user is invalid: Server Response: Specified user could not be found

Hi Mona,

 

Not quite. When I patch, I want the person's name to be updated/populated on a SharePoint list person column.

I wrote a similar function in another page: 

PowerAppsPeople.png

 

Which upon saving with other details of the form creates a record like this on my SharePoint list (Quamar Fatima Person is added to Notify Installation Column): 

 

PowerAppsSharePointPeople.png

 

Very strangely when I write a very similar piece of code on a different form for a similar patch on the same SharePoint list Multi-person column, it throws an error that resource is not found. Snippet of code and error on the 2nd patch function: 


Screenshot (44)_LI.jpg

Highlighted
Dual Super User III
Dual Super User III

Re: People picker Patch function - The specified user is invalid: Server Response: Specified user could not be found

Hi @qfatima 

 

Can you ensure that the choices columns has the correct arguments?

Choices(EntityyouWantToPatch.ColumnNameinEntity)

For more details please refer: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-choices 

If this is a person type field, the attribute name is "DisplayName", you can use PowerApps Intellisense to get the correct names.

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Highlighted
Frequent Visitor

Re: People picker Patch function - The specified user is invalid: Server Response: Specified user could not be found

Hi @yashag2255  and @v-monli-msft

 

Thank you for your replies. 

I still find it difficult to wrap my head around the concept of patching people.

Below, I have 2 people fields in the form: EstimatingSME and InstallationSME.

InstallationSME patches along with SubmitForm (I have not written any extra code)

and I wrote a patch function for EstimatingSME (which btw is similar to the code I have written else for patching a person and it works). But this EstimatingSME does not work. 

 

peoplepatch.png

 

 

I'm probably really newbie (and confused-bee if that's a word) to this, any leads appreciated!

Highlighted
Frequent Visitor

Re: People picker Patch function - The specified user is invalid: Server Response: Specified user could not be found

After some trial and error, I learned that we don't have to patch any values while submitting SharePoint list names in a form. 

However, if I have a defaulted user on a column (I had Office365Users.MyProfile()) as default, and in this case it did not patch the user. 

Highlighted
Community Support
Community Support

Re: People picker Patch function - The specified user is invalid: Server Response: Specified user could not be found

Hi @qfatima ,

 

Patch formula for person and group field should be something like:

{'@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:""
   }

 

You could have a look at below thread:

https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/Saving-data-from-powerapps-to-SP-li...

 

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.

View solution in original post

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

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,634)