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 / Populating a SharePoin...
Power Apps
Unanswered

Populating a SharePoint "People" field with a ComboBox in PowerApps that is populated with an AD group and making a default selection

(0) ShareShare
ReportReport
Posted on by 32

I am using a SharePoint list datasource, that has a "People/Group" field.  In my PowerApps, I would like to:

 

 1) Populate the Combo box items with people from an AD group

 2)  Save to the SharePoint list once a person is selected (COMPLETED)

3) Set the Default item to the current user if it's a new item OR for an existing item select the appropriate user (NOT COMPLETED)

 

I am going to add all of the steps just in case someone would like to perform the same actions, but I just need assistance with item 3.

 1) Populate the Combo box items with people from an AD group (COMPLETED)

         In the Combo box "Items" Property  add the following code "Sort(Office365Groups.ListGroupMembers("<ADD AD GROUP GUID>").value, displayName)"

           

MRKennedy_0-1696349169736.png

 

 2)  Save to the SharePoint list one a person is selected (COMPLETED)

Add the following code to the Data Cards "Update" property.  Note: the check for ISBLANK allow for the field to be required.  If it's not a required field, the IF statement is not needed.

If(IsBlank(DataCardValue5.Selected),
DataCardValue5.Selected,

{Claims:"i:0#.f|membership|" & DataCardValue5.Selected.mail,Department:"",DisplayName:DataCardValue5.Selected.displayName,Email:DataCardValue5.Selected.mail,JobTitle:"",Picture:""})

 

3) Set the Default item to the current user if it's a new item OR for an existing item select the appropriate user (NOT COMPLETED)

           When the page loads, I am unable to set the default selected item to either the currently logged in user, or the Person that comes from the SharePoint list.  I would like to do something like this is the "Default" property of the Combo box:

                  IF(DisplayMode = DisplayMode.Edit, ThisItem.Person, User())

            It seems I would need to lookup the ComboBox items by the display name or email since the objects in the Combobox list are not that same a the User() or SharePoint Item.. However, I have been unable to effectly use the Lookup or Find functions to match the names.

Categories:
I have the same question (0)
  • Ami K Profile Picture
    15,679 Super User 2024 Season 1 on at

    @MRKennedy - on the Default property of the DataCardValue, try:

     

    If(
     'Your Form'.Mode = FormMode.New,
     {
     DisplayName: User().FullName,
     Claims: "i:0#.f|membership|" & User().Email
     },
     Parent.Default)
    

     

  • MRKennedy Profile Picture
    32 on at

    Thank you for the quick reply.  For some reason, it won't select any of the items once I populate the combo box items with the AD group using: "Office365Groups.ListGroupMembers("<ADD AD GROUP GUID>").value" .  I can't get it to use the SharePoint item value or the current user.  It always shows as blank.  And I confirmed the item in the list has a person.   I just can't resolve the list item.  In standard programming you would just override the compare function but I am not sure how PowerApps is resolving the names in the list.

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

    @MRKennedy - I was writing a long response and then decided it was best to move it to a blog post.

     

    See if you can reuse/rework the method outlined below:

     

    https://powerusers.microsoft.com/t5/Power-Apps-Community-Blog/Replace-People-Picker-in-a-Form-with-Office365Groups/ba-p/2380287 

  • MRKennedy Profile Picture
    32 on at

    Worked Perfectly, thank you.  For anyone else trying the same thing.  You simply need to add this to the datacard (not the datacardvalue).

    // The if statement tells me if it's a new record, because it's a required field so it will have a value if it's an existing record

    If(!IsBlank(ThisItem."INSERT PROPERTYNAME".DisplayName),
    First(

    // Sets the default item to the value in the SharePoint list
    Filter(
    Office365Groups.ListGroupMembers("ENTER GUID").value,
    displayName = ThisItem.ENTER PROPERTY NAME.DisplayName
    )
    ),
    First(

    // Defaults to the logged in user
    Filter(
    Office365Groups.ListGroupMembers("ENTER GUID").value,
    displayName = Office365Users.MyProfileV2().displayName
    )
    )
    )

  • JohnB12 Profile Picture
    3 on at

    Thanks Mr Kennedy!!

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