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 / Multiple default selec...
Power Apps
Unanswered

Multiple default selected items for combobox with office365users as combobox datasource

(2) ShareShare
ReportReport
Posted on by 6
have a combobox that has the following code as the items property
 
 
 
 
It is multi-select and works fine. It saves a concatenated string of the selected users display name into a field, and a concatenated string of the users email into a separate field.
 
 
 
ex. Name field "Bill Bilson, Tod Todson"
 
ex. Email Field "BillBillson@website.com, TodTodson@website.com"
 
 
 
I have no issue retrieving just one user to the default selected property using either of these lines of code
 
First(Office365Users.SearchUserV2({searchTerm:varRecord.'Project Owner Email'}).value)
 
 
or 
 
LookUp(Office365Users.SearchUser({searchTerm:varRecord.'Project Owner Email',top:1}),DisplayName = ThisItem.'Project Owner Name')
 
 
My issue comes when I try and set multiple users as the default selected item property using the following code



 
Filter(Office365Users.SearchUserV2({searchTerm:varRecord.'Project SME Email',top:10}).value,DisplayName in VarDefaultSME)
 
 
 
varRecord.'Project SME Email' = string of users emails that are saved to Dataverse and I wish to populate as the defualt selected items
 
 
 
ex."BillBillson@website.com, TodTodson@website.com"



 
VarDefualtSME.Value is a table that consist of the users FULL Names in a table
 
 
 
Any ideas on where I am making a mistake here? Thanks!
 
 
 

 
Categories:
I have the same question (0)
  • MarkRahn Profile Picture
    1,229 Super User 2025 Season 2 on at
     
    I created a Test App to see if I could help you out. I think your issue is with what you have your SearchField set to in Fields:
     
    It should be set to "Mail".
     
    I added two comboboxes and a button.
     
    For ComboBox1, this is the relevant code:
    - ComboBox1:
        Control: Classic/ComboBox@2.4.0
        Properties:
          DisplayFields: =["DisplayName"]
          Items: =Sort(Office365Users.SearchUser({searchTerm:(Self.SearchText),top:(999)}),DisplayName,SortOrder.Ascending)
          SearchFields: =["Mail"]
     
     
    For Button1, this is the relevant code:
    - Button1:
        Control: Classic/Button@2.2.0
        Properties:
          OnSelect: |-
            = Set(varStringOfEmails, Concat(ComboBox1.SelectedItems, Mail, "; "));
     
     
    I set a variable to be the string of Mail values selected which is what you said you are storing in the DataVerse field.
     
    All of this was just to be able to capture some selected Users to use in ComboBox2 which has this relevant code:
    - ComboBox2:
        Control: Classic/ComboBox@2.4.0
        Properties:
          DefaultSelectedItems: |-
            =Filter(
                Office365Users.SearchUser({ searchTerm: "", top: 999 }),
                Mail in Split(varStringOfEmails, "; ")
            )
          DisplayFields: =["DisplayName"]
          Items: =Sort(Office365Users.SearchUser({searchTerm:(Self.SearchText),top:(999)}),DisplayName,SortOrder.Ascending)
          SearchFields: =["Mail"]
     
    So for your example, set your SeachFields to ["Mail"] and set your DefaulSelectedItems to :
     
    Filter(
                Office365Users.SearchUser({ searchTerm: "", top: 999 }),
                Mail in Split(varDefaultSME, ", ")
            )
     
    "Mail" is the email address field in Office365Users. "DisplayName" is the user's full name. This is why you are unable to get things to match up. You are storing a concatenated list of users email addresses and then trying to filter Office365Users on the DisplayName field.
     
    I hope this helps you. Let me know if you are still having issues.
     
    This community is supported by individuals freely devoting their time to answer questions and provide support. They do it to let you know you are not alone. This is a community.

    If someone has been able to answer your questions or solve your problem, please click Does this answer your question. This will help others who have the same question find a solution quickly via the forum search.

    If someone was able to provide you with more information that moved you closer to a solution, throw them a Like. It might make their day. 😊

    Thanks
    -Mark
  • Community member Profile Picture
    6 on at
     
    Thank for the response! Unfortunately, I am still getting a blank return for the default selected items. 
     
    Items
     
    Sort(Office365Users.SearchUser({searchTerm:(Self.SearchText),top:(999)}),DisplayName,SortOrder.Ascending)
     
     
    Display Fields =  
    ["DisplayName"]
     
     
    Search Field
    ["Mail"]
     
    Default selected items
     
    Filter(
        Office365Users.SearchUser(
            {
                searchTerm: "",
                top: 999
            }
        ),
        Mail in Split(
            varRecord.'Project SME Email',
            ","
        )
    )
     
    varRecord.'Project SME Email' TestEmail1@Test.com, TestEmail2@Test.com 
     
    I noticed there is a space after the comma separating the emails in the variable? I wonder if that is causing the issue
  • MarkRahn Profile Picture
    1,229 Super User 2025 Season 2 on at
    What is the data type for varRecord.'Project SME Email'? Is it a Text field or something else? Is it connected to the Dataverse User System Table?
     
    Can you try to hard code the Default Selected Items?
     
    Filter(
        Office365Users.SearchUser(
            {
                searchTerm: "",
                top: 999
            }
        ),
        Mail in Split(
            "TestEmail1@Test.com, TestEmail2@Test.com",
            ","
        )
    )
     
    If the above works, then the issue is with the Data Type for 'Project SME Email'. Remember that the emails you provide for the Filtering on Mail have to exist. (I am assuming you know that to be the case. 😉)
     
    Let me know what you find.
     
    This community is supported by individuals freely devoting their time to answer questions and provide support. They do it to let you know you are not alone. This is a community.

    If someone has been able to answer your questions or solve your problem, please click Does this answer your question. This will help others who have the same question find a solution quickly via the forum search.

    If someone was able to provide you with more information that moved you closer to a solution, throw them a Like. It might make their day. 😊

    Thanks
    -Mark

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