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 / Update Person field
Power Apps
Answered

Update Person field

(0) ShareShare
ReportReport
Posted on by 138

Hi 

 

 

I have 2 Comboboxes and a button on a screen. 

 

Both ComboBoxes pull a list of managers from a Person Field in a sharepoint list using: 

ComboBox2:

Distinct('LTS Leave Approvers'.Primary, Primary.DisplayName)

 

ComboBox2_1:

Distinct('LTS Leave Approvers'.Primary, Primary.DisplayName)

 

 

I would like to add code to the button which checks a different sharepoint list for any entries where the Person in ComboBox2 is listed in the "Approvers" Person field, and where the "ApprovalStatus" choice field is "Awaiting Approval." Then for all entries that meet these requirements, add the person from ComboBox2_1 to the "DelegatedApprovers" Person field. 

 

Here's the code that I'm currently using: 


ForAll(
Filter(
'Holiday Request Tool',
Approver.DisplayName = ComboBox2.Selected.DisplayName && ApprovalStatus = "Awaiting Approval"
),
Patch(
'Holiday Request Tool',
LookUp(
'Holiday Request Tool',
ID = Current.ID
),
{
'DelegatedApprover': {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & ComboBox2_1.Selected.Mail,
Department: "",
DisplayName: ComboBox2_1.Selected.DisplayName,
Email: ComboBox2_1.Selected.Mail,
JobTitle: "",
Picture: ""
}
}
)
)


The error shows Incompatible types for comparison. Can anyone help please?

 

Thanks, 

 

 

 

 

Categories:
  • Ami K Profile Picture
    15,689 Super User 2024 Season 1 on at

    Hi @stephenjcarr ,

     

    To repeat your scenario as I understand it, when a User selects a specific user from from the Combo Box 2, Patch the DelegatedApprovers field with the selected user from Combo Box 2_1 in the Holiday Request SharePoint list on the condition that:

     

    1. The selected User from Combo Box 2 exists in your other SharePoint list and,
    2. If the Choice field (ApprovalStatus) associated to that User in other SharePoint list = "Awaiting Approval"

     

    There is no need to use the Distinct expression on both Combo boxes. Change the Items property on both to:

     

     

    Choices([@'LTS Leave Approvers']. Primary)

     

     

    Then select Display Name from the properties pane for the Combo Box control:

     

    Amik_0-1687628695638.png

     

    Apply the following to the OnSelect property of your button:

     

     

    If(
     !IsBlank(
     LookUp(
     'Your Other List',
     'Approvers'.Email = ComboBox2.Selected.Email,
     'Approvers'.DisplayName
     )
     ) && LookUp(
     'Your Other List',
     'Approvers'.Email = ComboBox2.Selected.Email,
     ApprovalStatus.Value = "Awaiting Approval"
     ),
     Patch(
     'Holiday Request Tool',
     LookUp(
     'Holiday Request Tool',
     ID = Current.ID
     ),
     {
     DelegatedApprovers: {
     Claims: "i:0#.f|membership|" & Lower(ComboBox2_1.Selected.Email),
     Department: "",
     DisplayName: ComboBox2_1.Selected.Email,
     Email: ComboBox2_1.Selected.Email,
     JobTitle: ".",
     Picture: "."
     }
     }
     )
    )

     

     

    ------------------------------------------------------------------------------------------------------------------------------

     

    If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

    If you like my response, please give it a Thumbs Up.

  • stephenjcarr Profile Picture
    138 on at

    Hi @Amik Thanks for your reply, but its not quite what I'm looking to do. 

     

    We can maybe make this a bit less complicated and just use 1 sharepoint. "Holiday Request Tool". 

     

    When the user presses a button, find all entries in the sharepoint "Approvers" column that match the Person selected in ComboBox2, then replace the Person in the "Approvers" column with the Person selected in ComboBox2_1 

    For Example; ComboBox2 contains Person "John Smith" and ComboBox2_1 contains "Jane Smith"
    When the button is pressed, find all entries for "John Smith" in the "Approvers column and replace with "Jane Smith" 

    Thanks, 

  • stephenjcarr Profile Picture
    138 on at

    I tried this, but it didnt work 

    Patch(
    'Holiday Request Tool',
    Filter('Holiday Request Tool', Approver.Email = ComboBox2.Selected.Value.Email),
    {
    Approver: {
    '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
    Claims: "i:0#.f|membership|" & ComboBox2_1.Selected.Value.Email,
    DisplayName: ComboBox2_1.Selected.Value.DisplayName,
    Email: ComboBox2_1.Selected.Value.Email,
    Picture: ComboBox2_1.Selected.Value.Picture
    }
    }
    )

  • Verified answer
    Ami K Profile Picture
    15,689 Super User 2024 Season 1 on at

    Hi @stephenjcarr ,

     

    You do not need Patch or For All. UpdateIf is the out of the box function for this scenario:

     

    UpdateIf(
     'Holiday Request Tool',
     Approver.Email = ComboBox2.Selected.Email,
     {Approver: ComboBox2_1.Selected}
    )

     

    ------------------------------------------------------------------------------------------------------------------------------

     

    If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

    If you like my response, please give it a Thumbs Up.

  • stephenjcarr Profile Picture
    138 on at

    Thanks @Amik!

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 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard