web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Error when patching pe...
Power Apps
Unanswered

Error when patching person column

(0) ShareShare
ReportReport
Posted on by

Hello Everyone,

 

I have a combobox that patches to a person column. However, there are some users whose details do not patch. It gives a network error message that says ": requested operation is invalid". I don't have this issue with the majority of users. What could the problem be?

//submit the form data
Set(varCurrentAdminRecord,
Patch(
 Units,
 varCurrentAdminRecord,
 {
 Unit: txt_AdminUnits_Unit1_1.Text,
 Department: txt_AdminUnits_Dept1_1.Text,
 UnitHead: {
 '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
 Claims: "i:0#.f|membership|" & cmb_AdminUnits_UnitHead1_1.Selected.DisplayName,
 Department: "",
 DisplayName: cmb_AdminUnits_UnitHead1_1.Selected.DisplayName,
 Email: cmb_AdminUnits_UnitHead1_1.Selected.DisplayName,
 JobTitle: "",
 Picture: ""
 },
 DepartmentHead: {
 '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
 Claims: "i:0#.f|membership|" & cmb_AdminUnits_DeptHead1_2.Selected.DisplayName,
 Department: "",
 DisplayName: cmb_AdminUnits_DeptHead1_2.Selected.DisplayName,
 Email: cmb_AdminUnits_DeptHead1_2.Selected.DisplayName,
 JobTitle: "",
 Picture: ""
 },
 Members:ForAll(
 cmb_AdminUnits_PayRequester_1.SelectedItems,
 {
 '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
 Claims: "i:0#.f|membership|" & ThisRecord.DisplayName,
 Department: "",
 DisplayName: ThisRecord.DisplayName,
 Email: ThisRecord.DisplayName,
 JobTitle: "",
 Picture: ""
 }
 )
 }
));

// check for errors
If(
 IsEmpty(Errors(Units)),
 // on success
 UpdateContext({locAdminFormDisplayMode: "View"});
 Notify(
 "Success: Record Saved",
 NotificationType.Success
 ),
 // on failure
 Notify(
 Concat(Errors(Units), Column&": "&Message),
 NotificationType.Error
 )
);
Refresh(Units)

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    152,843 Most Valuable Professional on at
    Re: Error when patching person column

    Hi @AdaEloka ,

    Two things- I will give you some alternative structure to try (note Email may be Mail depending on the Items of your Combo Boxes)

    Set(
     varCurrentAdminRecord,
     Patch(
     Units,
     {
     ID: varCurrentAdminRecord.ID,
     Unit: txt_AdminUnits_Unit1_1.Text,
     Department: txt_AdminUnits_Dept1_1.Text,
     UnitHead: 
     {
     Claims: "i:0#.f|membership|" & Lower(cmb_AdminUnits_UnitHead1_1.Selected.Email),
     Department: "",
     DisplayName: cmb_AdminUnits_UnitHead1_1.Selected.DisplayName,
     Email: cmb_AdminUnits_UnitHead1_1.Selected.Email,
     JobTitle: "",
     Picture: ""
     },
     DepartmentHead: 
     {
     Claims: "i:0#.f|membership|" & Lower(cmb_AdminUnits_DeptHead1_2.Selected.Email),
     Department: "",
     DisplayName: cmb_AdminUnits_DeptHead1_2.Selected.DisplayName,
     Email: cmb_AdminUnits_DeptHead1_2.Selected.Email,
     JobTitle: "",
     Picture: ""
     },
     Members:
     ForAll(
     cmb_AdminUnits_PayRequester_1.SelectedItems As _Sel,
     {
     Claims: "i:0#.f|membership|" & Lower(_Sel.Email),
     Department: "",
     DisplayName: _Sel.DisplayName,
     Email: _Sel.Email,
     JobTitle: "",
     Picture: ""
     }
     )
     }
     )
    );

     but I noticed you are saving the DisplayName in the Claims, Email and DisplayName fields. If this is intentional, why use a Person field, just save it to a Single Line of Text. I have used the email in the code above.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • AdaEloka Profile Picture
    on at
    Re: Error when patching person column

    It still gives the same error. I saved DisplayName in the ClaimsEmail and DisplayName fields because that's the only option I get after ".Selected." Anything else results in the red squiggly lines appearing...

  • WarrenBelz Profile Picture
    152,843 Most Valuable Professional on at
    Re: Error when patching person column

    @AdaEloka ,

    You need to look at the Items of the three Combo Boxes cmb_AdminUnits_UnitHead1_1, cmb_AdminUnits_UnitHead1_2 and cmb_AdminUnits_PayRequester_1 and ensure you have a Person structure if you want to do what you are currently attempting.

  • AdaEloka Profile Picture
    on at
    Re: Error when patching person column

    This is what I now have in the Items property but it still gives the same error... Office365Users.SearchUser({searchTerm: Self.SearchText, top: 100})

     

    I've also changed the Claims, and Email  fields to use ".Mail" instead of ".DisplayName"

     

     

  • AdaEloka Profile Picture
    on at
    Re: Error when patching person column

    I've checked the details of the error message and this is what it shows... "patch person column error "The specified user i:0#.f|membership| could not be found."

    This is my updated formula... 

    //submit the form data
    Set(varCurrentAdminRecord,
    Patch(
     Units,
     varCurrentAdminRecord,
     {
     Unit: txt_AdminUnits_Unit1_1.Text,
     Department: txt_AdminUnits_Dept1_1.Text,
     UnitHead: {
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     Claims: "i:0#.f|membership|" & Lower(LookUp(Office365Users.SearchUserV2().value,DisplayName = cmb_AdminUnits_UnitHead1_1.Selected.DisplayName).Mail),
     Department: "",
     DisplayName: cmb_AdminUnits_UnitHead1_1.Selected.DisplayName,
     Email: cmb_AdminUnits_UnitHead1_1.Selected.Mail,
     JobTitle: "",
     Picture: ""
     },
     DepartmentHead: {
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     Claims: "i:0#.f|membership|" & Lower(LookUp(Office365Users.SearchUserV2().value,DisplayName = cmb_AdminUnits_DeptHead1_2.Selected.DisplayName).Mail),
     Department: "",
     DisplayName: cmb_AdminUnits_DeptHead1_2.Selected.DisplayName,
     Email: cmb_AdminUnits_DeptHead1_2.Selected.Mail,
     JobTitle: "",
     Picture: ""
     },
     Members:ForAll(
     cmb_AdminUnits_PayRequester_1.SelectedItems As _Sel,
     {
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     Claims: "i:0#.f|membership|" & Lower(LookUp(Office365Users.SearchUserV2().value,DisplayName = _Sel.DisplayName).Mail),
     Department: "",
     DisplayName: _Sel.DisplayName,
     Email: _Sel.Mail,
     JobTitle: "",
     Picture: ""
     }
     )
     }
    ));
    
    // check for errors
    If(
     IsEmpty(Errors(Units)),
     // on success
     UpdateContext({locAdminFormDisplayMode: "View"});
     Notify(
     "Success: Record Saved",
     NotificationType.Success
     ),
     // on failure
     Notify(
     Concat(Errors(Units), Column&": "&Message),
     NotificationType.Error
     )
    );
    Refresh(Units)

     

  • WarrenBelz Profile Picture
    152,843 Most Valuable Professional on at
    Re: Error when patching person column

    @AdaEloka ,

    Have you checked your data to ensure you have data in the required fields/controls ? The code is valid and the fact it works for some users confirms this.

  • AdaEloka Profile Picture
    on at
    Re: Error when patching person column
    Yes I have
  • WarrenBelz Profile Picture
    152,843 Most Valuable Professional on at
    Re: Error when patching person column

    @AdaEloka ,

    I think you need to look at permissions - generally user-related access / error issues relate to this in some way. There in nothing wrong with the code that I can see.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 836 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 231 Super User 2025 Season 2

Last 30 days Overall leaderboard