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

Announcements

News and Announcements icon
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:
  • WarrenBelz Profile Picture
    156,921 Most Valuable Professional on at

    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

    It still gives the same error. I saved DisplayName in the Claims, Email 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
    156,921 Most Valuable Professional on at

    @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

    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

    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
    156,921 Most Valuable Professional on at

    @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
    Yes I have
  • WarrenBelz Profile Picture
    156,921 Most Valuable Professional on at

    @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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard