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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patch function using P...
Power Apps
Unanswered

Patch function using Person Type column in Gallery

(1) ShareShare
ReportReport
Posted on by 138
Hi
 
I have a Gallery which need to add Contract points for multiple people review. Refer the below . Appreciate your help.
 
 
In Save button -> On Select function coding kept as below: 
 
Patch(
    ContractRegister,
    ShowColumns(
        colGridUpdates,
        Title,
        RiverbankRefandCriteria,
        CustomerContract,
        PreApproverName,
        ApprovalStatus,
        ContractLookup,
        ID
     )
);
Select(btnLoadGrid);
Notify(
    "New lines Saved",
    NotificationType.Success
)
 
 
A button Created "btnupdate"  in order to avoid repetition in same task with below coding On Select, but "PreapproverName" column is not get updated in the Gallery while adding the new line. 
 
If(
    IsBlank(
        LookUp(
            colGridUpdates,
            ID = ThisItem.ID
        )
    ),
    Collect(
        colGridUpdates,
        ThisItem
    )
);
UpdateIf(
    colGridUpdates,
    ID = ThisItem.ID,
    {
     Title: txtTitle.Value,
                RiverbankRefandCriteria: {Value : drpRiverbankRef.Selected.Value},
                CustomerContract: txtCustomerCtc.Value,
                PreApproverName: {      
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",      
            Claims: "i:0#.f|membership|" & Lower(drpPreapproverName.Selected.mail),
            Department: "",
            DisplayName: drpPreapproverName.Selected.displayName,
            Email: drpPreapproverName.Selected.mail,
            JobTitle: "",
            Picture: ""
            },
            ApprovalStatus: {Value: drpApprovalStatus.Selected.Value}
    }
)
 
I have the same question (0)
  • trice602 Profile Picture
    15,402 Super User 2025 Season 2 on at
    Hi,
     
    Wrong channel, I recommend posting this in Power Apps vs Power Automate.  Good luck!
     
     
  • Suggested answer
    Ellis Karim Profile Picture
    11,681 Super User 2025 Season 2 on at
     
    The minimum you need you need to patch a person column in PowerApps is just the UPN or Email:
    {
        "Claims": drpPreapproverName.Selected.mail,
        "Department": "",
        "DisplayName": "",
        "Email": "",
        "JobTitle": "",
        "Picture": ""
    }
     
     
     

    Ellis Karim Ellis Karim
    Blog | LinkedIn | Bluesky

  • schithambaran Profile Picture
    138 on at
    Thank you so much for the response
    but the error shows that "Invalid argument type (Table). Expecting a Record value instead. we are nearing to the solution, appreciate your support.
     


     
     
     
     
  • Ellis Karim Profile Picture
    11,681 Super User 2025 Season 2 on at
    The editor shows a problem is with the ShowColumns. unless filtering specific fields.
    Try:
    Patch(
        ContractRegister,
        colGridUpdates,
        ...
     
    And you should only need to specify just the claims to patch a People column.
    Try only including the following columns for the  PreApproverName:
     
    EXAMPLE:
    Patch(
        Acronyms,
        Defaults(Acronyms),
        {
            'Added By': {
                Claims: "JoniS@onmicrosoft.com",
                DisplayName: "",
                Email: "",
                Picture: "",
                Department: "",
                JobTitle: ""
            }
        }
    )
     
    If the PreApproverName is a multi-select People column we use a table.
     
    Patch(
        Acronyms,
        Defaults(Acronyms),
        {
            'Added By': Table({
                Claims: "DiegoS@onmicrosoft.com",
                DisplayName: "",
                Email: "",
                Picture: "",
                Department: "",
                JobTitle: ""
            }
            )
        }
    )
     
     

    Ellis Karim Ellis Karim
    Blog | LinkedIn | Bluesky

     
  • schithambaran Profile Picture
    138 on at
    Thank you so much for the suggestions. But based on the below coding an additional line added instead of patching the existing line. can you please guide
     
     
    Patch(
        ContractRegister,
        Defaults(colGridUpdates),
        {
        Title: Concatenate("Title Text",Now()),
        PreApproverName: { '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
                               'Claims': "i:0#.f|membership|" & Lower(drpPreapproverName.Selected.mail),
                               DisplayName: "",
                               Email: "",
                               Picture:"",
                               Department:"",
                               JobTitle: ""}
     
     
    Even tried the other option:
     
    Patch(
        ContractRegister,
        Defaults(colGridUpdates),
        {
        Title: Concatenate("Title Text",Now()),
        PreApproverName: Table({ '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
                               'Claims': "i:0#.f|membership|" & Lower(drpPreapproverName.Selected.mail),
                               DisplayName: "",
                               Email: "",
                               Picture:"",
                               Department:"",
                               JobTitle: ""}
        })
     
    Error : The type of this argument 'PreApproverName' does not match the expected type 'Record'. Found type 'Table'.
  • Ellis Karim Profile Picture
    11,681 Super User 2025 Season 2 on at
     
    Please try the following which I have tested. This should give you an idea of where to focus on to fix the issue:
     
    SharePoint List
     
    Patch(
        ContractRegister,
        Gallery1.Selected,
        {
            PreApproverName: {
                Claims: Gallery1.Selected.drpPreapproverName.Email,
                Department: "",
                DisplayName: "",
                Email: "",
                JobTitle: "",
                Picture: ""
            }
        }
    )
    Patching gallery items in Power Apps
     
     
     
     
     
     
     

    Ellis Karim Ellis Karim
    Blog | LinkedIn | Bluesky

     
  • schithambaran Profile Picture
    138 on at
    Hi Ellis / @Ellis Karim
     
    Good Day!!
    Thank you so much for the detailed explanation about Patch. Appreciate your help to resolve this issue.
     
    Please note that Patch function is completely working fine except for the Person type column.   The below code will work perfectly if I will exclude "PreapproverNames" person type column. This is the syntax which I need your help to include in the below coding. Hope I explained well.
     
    Patch(
        ContractRegister,
       ShowColumns(colGridUpdates, Title, RiverbankRefandCriteria, CustomerContract, ApprovalStatus, ContractLookup, ID)
       );
    Select(btnLoadGrid);
    Notify(
        "New lines Saved",
        NotificationType.Success
    )
     
     
    I tried the below coding too, but showing an error "Unexpected characters. The formula contains 'Colon' where 'ParenClose' is expected". 
     
    Patch(
        ContractRegister,
       ShowColumns(colGridUpdates, Title, RiverbankRefandCriteria, CustomerContract,
                PreApproverName:{@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",      
                Claims: "i:0#.f|membership|" & Lower(drpPreapproverName.Selected.mail),
                Department: "",
                DisplayName: "",
                Email: drpPreapproverName.Selected.mail,
                JobTitle: "",
                Picture: ""
                } ApprovalStatus, ContractLookup, ID)
       );
    Select(btnLoadGrid);
    Notify(
        "New lines Saved",
        NotificationType.Success
    )
  • Ellis Karim Profile Picture
    11,681 Super User 2025 Season 2 on at
     
    (1) Please write a test patch that only updates the person column. Do this to confirm that your code works, and you are able to patch the person column successfully.  Don't update anything else in the patch, only patch the person column.
     
    (2) As I wrote before, do not include the following in the patch:
    @odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser"

    Please specify the minimum properties for patching the person column as shown in the example below. You only need to configure the Claims, and for that the email address is all that is needed: 
    Patch(
        ContractRegister,
        Gallery1.Selected,
        {
            PreApproverName: {
                Claims: Gallery1.Selected.drpPreapproverName.Email,
                Department: "",
                DisplayName: "",
                Email: "",
                JobTitle: "",
                Picture: ""
            }
        }
    )
     

    Ellis Karim Ellis Karim
    Blog | LinkedIn | Bluesky

  • schithambaran Profile Picture
    138 on at
    Hi Ellis
     
    Thank you, I tried and received an error. Please assist.
     
    Patch(
        ContractRegister,
        TasksGallery.Selected,
        {
            PreApproverName: {
                Claims: TasksGallery.Selected.drpPreapproverName.Email,
                Department: "",
                DisplayName: "",
                Email: "",
                JobTitle: "",
                Picture: ""
            }
        }
    );
     
    Invalid argument type. Expecting a Record value, but of a different schema.
    Incompatible type. The 'Claims' column in the data source you’re updating expects a 'Text' type and you’re using a 'Error' type.
  • Suggested answer
    Ellis Karim Profile Picture
    11,681 Super User 2025 Season 2 on at
     
    I believe the error occurs because the drpPreapproverName column is a Text field rather than a Person column.
     
    This mismatch is likely causing the issue.
     
    I was able to reproduce a similar error:
     
    Patching error due to confusing a Person column with a plain text column.
     
    On my test site, both drpPreapproverName and PreApproverName are Person columns, which is why the Patch code works without issues:
     
    SharePoint columns showing both drpPreapproverName and PreApproverName are Person columns, which is why the Patch code works without issues:
     
     
    Please check the following:
     
    (1) Check the column type for drpPreapproverName: I suspect it is a Text column instead of a Person column.
     
    (2) Verify the content of drpPreapproverName?
    Does it contain the email address (tom.test@example.com) or the Display Name of the approver (eg. Tom Test)
     
    You can use either the email address (e.g. tom.test@example.com) OR the DISPLAY NAME of the approver (eg. Tom Test) to patch a Person column.  
     
    However, while Display Name might work (as I found during testing), it is NOT recommended!
     
    I recommend always using the email address when patching a Person column, this is best practice.
     
     
    (3) Update the Patch code based on the column type-for drpPreapproverName:
     
    Patching a person column. Showing 2 examples using the display name for the claims and the email address for the claims
     
    The issue with using the Display Name is that it is not unique. Multiple users can have the same Display Name but different UPNs and email addresses. As a result, the Patch function may only select the first matching user, leading to inaccurate data.
     
    On my tenant, I changed two user accounts to have exactly the same display names: Lee Gu.
     
    Entra ID users with the same display name but different UPNS and email ddresses
     

    Ellis Karim Ellis Karim
    Blog | LinkedIn | Bluesky

     

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard