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 / DefaultSelectedItems o...
Power Apps
Unanswered

DefaultSelectedItems of People Combobox: auto select from collection based on conditional

(0) ShareShare
ReportReport
Posted on by 878

For my Sharepoint list form, I have a People column. I want this to be autopopulated depending if 

Label8.Text = "ES"

The combobox is populated by the collection of 6 people named "Responsables". So, if it "ES", I need it to auto select 3 people, if not, the remaining 3. I'm guessing I'll have to write into the code their specific emails. 

Right now the DefaultSelectedItems property is set to:

Filter(
 Responsables;
 UserPrincipalName in ThisItem.'Sharepoint People Column'.Email
)

This is the only way I managed to make it save to Sharepoint and actually retain information when editing. 

Responsables is a collection made with many lines like this:

Collect(Responsables; { DisplayName: "NAME"; UserPrincipalName: "NAME@company.com"; Mail: "NAME@company.com"})

 

Categories:
  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @WorkingRicardo ,

     

    The Responsables collection should be:

    Collect(
     Responsables; 
     {
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser";
     Department: "";
     Claims: "i:0#.f|membership|" & "UserA@xxx.com";
     DisplayName:"UserA";
     Email: "UserA@xxx.com";
     JobTitle: "";
     Picture: ""
     }
    )
    

     

    Best Regards,

    Bof

  • WorkingRicardo Profile Picture
    878 on at

    hello @v-bofeng-msft ty for your reply. Ohh is there a problem with the collection long term the way I have it set up? I ChatGPT-ed this a bit and came up with a solution for the DefaultSelectedItems:

     

    If(
     Label8.Text = "ES";
     Filter(
     Responsables;
     UserPrincipalName in ["person1@example.com"; "person2@example.com"; "person3@example.com"]
     );
     Filter(
     Responsables;
     UserPrincipalName in ["person4@example.com"; "person5@example.com"; "person6@example.com"]
     )
    )

     

    This way is working. But do let me know if you foresee some issues coming up!

  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @WorkingRicardo ,

     

    If you create the responsables collection by this formula:

    Collect(
     Responsables; 
     {
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser";
     Department: "";
     Claims: "i:0#.f|membership|" & "UserA@xxx.com";
     DisplayName:"UserA";
     Email: "UserA@xxx.com";
     JobTitle: "";
     Picture: ""
     }
    )

    Please set the combo box's DefaultSelectedItems property to

    If(
     Label8.Text = "ES";
     Filter(
     Responsables;
     Email in ["person1@example.com"; "person2@example.com"; "person3@example.com"]
     );
     Filter(
     Responsables;
     Email in ["person4@example.com"; "person5@example.com"; "person6@example.com"]
     )
    )

     

    Best Regards,

    Bof

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

#2
Mohsin Ali Profile Picture

Mohsin Ali 354

#3
WarrenBelz Profile Picture

WarrenBelz 232 Most Valuable Professional

Last 30 days Overall leaderboard