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 / ComboBox DefaultSelect...
Power Apps
Unanswered

ComboBox DefaultSelectedItems w/ Office 365 Users Connector

(0) ShareShare
ReportReport
Posted on by 36

I am looking to setup a combobox for of users with the Office 365 Users connector and while I was able to properly populate the combobox, I am having trouble setting up the DefaultSelectedItems property for the combobox on my edit form.  The PowerApp pulls the majority of the data from a SQL Server where i have a User field in my table (we will call it Table1 for the sake of the example). So for example if on the Detail Screen the txtUser = "Mike" then when selecting to edit the record, I want the DefaultSelectedItem for the comboboxUser to already have "Mike" selected.  I have tried several methods from LookUp to context variable and have not had much luck.  Has anyone been able to setup the DefaultSelectedItems for Office 365 Users and if so how did you structure your formula to select the User from Office 365 Users that is stored in the SQL database.

Categories:
I have the same question (0)
  • dhofknecht Profile Picture
    36 on at

    After some more testing I found that this worked for me:

    Office365Users.SearchUser({searchTerm:txtUser})

  • avitas Profile Picture
    25 on at

    Great - I had the same problem and your solution solved it. One question though - hopefully someone can answer:

     

    if you want to select several items as default...?  In my NewForm I've selected 3 users and updated that to my datasource (excel) using Concat(ComboBox_user.SelectedItems;DisplayName;";"). 

    Your formula (in my version Office365users.SearchUser({searchTerm:DataCardValue2}) - only preselects correctly when datacardvalue2 contains single user, not when it contains multiple users (user1;user2;user3).

    Any Idea @dhofknecht how to make default select user1 and user2 and user 3?

     

    Cheers,  Preben

  • Dawidvh Profile Picture
    1,346 on at

    Hello @dhofknecht ,

     

    You should be able to use a forall to find the relevant items in the array.
    ForAll(
    ["value1","value2"],
    First(Office365Users.SearchUserV2({searchTerm: Value,top:1}).value)
    )

     

    Let me know if you don't come right.

  • Community Power Platform Member Profile Picture
    on at

    Hi, @DavesTechTips 

     

    I know this thread is old, but I'm having trouble getting your formula to work correctly. In my table, I have five email addresses, which I want to be the default selected items in my combo box, with the combo box showing their names. However, when I use your formula, only the first person in the table is returned. If I remove the First() and top:1 bits, then "[object Object]" is returned.

     

    Here's what I have in ComboBox1.DefaultSelectedItems now. It's returning "[object Object]."

     

    ForAll(
     ItemDetail.Contacts, //This table contains 0–10 email addresses.
     Office365Users.SearchUserV2({searchTerm: Value}).value.DisplayName
    )

     

     

    What am I doing wrong here?

     

    Edit: My bad. The formula I used works. My problem was that I had ComboBox1.SelectMultiple set to false. Once I set it to true, it worked fine. Dumb oversight on my part.

  • AkankshaGupta Profile Picture
    11 on at

    Hi @Anonymous ,I tried same approach to display selected users but getting [object obejct] issue even though select multiple is checked .However i'm getting [Object Object] 3 times if there are 3 usernames expected in default .

    I'm using this combo box in a form and in view mode it should show selected users which was saved in 'UserTable' in newform/editform mode .

     

     

    ForAll(Filter(UserTable,ThisItem.ID=CurrentIDOnForm),
     Office365Users.SearchUserV2({searchTerm:ThisRecord.UserEmail}).value.Mail)

     

     

  • Community Power Platform Member Profile Picture
    on at

    Hi, @AkankshaGupta. I almost never use PowerApps controls in "view" mode (I assume you mean DisplayMode.View in the DisplayMode property), because it tends to do strange, strange things to the parameter behaviours. If I need to prevent a user from clicking something, I typically cover it with a transparent rectangle with the OnSelect property equal to false.

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