cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
k3rnel-pan1c
Frequent Visitor

Combo Box o365 User Search

Hi all,

 

I'm working on a PowerApp where I use a Combo Box connected to O365 Users.

The idea is to have this field named "Collaborators" where you can select one or more usernames.

This is after saved into a Sharepoint List with some other data and viewed from a Gallery in the PowerApp.

 

Everything up to this point works perfectly.

 

What I want to accomplish now is create an edit view. I want to auto populate the Combo Box with the user names selected previously and have the option to select more users or remove the ones already selected.

 

Combo Box:

Items = Office365Users.SearchUser({searchTerm:ComboBox_Coll.SearchText}).DisplayName

DefaultSelectedItems = Office365Users.SearchUser({searchTerm: Parent.Default}).DisplayName

This solution only works if I select one User, when I have multiple users selected nothing works, the problem seems to be that the usernames are comma separated in one single string.

 

Any Idea on how can I fix this?

 

Thanks.

11 REPLIES 11
Anonymous
Not applicable

Hi @v-micsh-msft !
I thought your solution was the one for me , but I have came to a dead-end.

 

What I have :
I have a sql data table called '[dbo].[Solutions]' as a data source.
In this table, I have a column "Persons in charge".
On my app, I have 1 datacard "Persons in charge"  containing:

  •   A toggle false = "Use ComboBox Control", true = "Enter custom value"
  • A ComboBox ctrl. Items=Office365Users.DirectReports(myManagerProfile.Id) (should be the current user's coworkers)
  • A TextField.

The user can select amongst his coworkers or fill the TextField with some custom entry (like, for instance, an external user, or a service)

 

When the user selects "Use ComboBox Control" and selects users from the ComboBox, I have set

OnChange= Set(pInCharge,pInCharge&UserComboBox_Ctrl.Selected.Id&";")


Which gives me "MyUser1@domain.com;MyUser2.domain.com;" and is saved under my datatable.

I now would like to set the DefaultSelectedItems of that comboBox to the users in the Persons in charge column from my database.


So here is my formula, totally based on yours :

If(
    CreateEditSolution_Form.Mode = FormMode.Edit,
    If(
        Not(
            IsBlank(
                Find(
                    "@",
                    Parent.Default
                )
            )
        ),
        ForAll(Split(Parent.Default,";"),First(Office365Users.SearchUser({searchTerm:Result})).DisplayName)
    )
)


But I have absolutely nothing when I open my form under Edit mode.

 

Dp you have any idea why this does not work ?
Thanks a lot !

@k3rnel-pan1c - Did you figure this out with it adding that first user on each save - two years ago? I've been Googling for hours and am fairly experienced building Power Apps. I'm only using these field configurations (office365users.SearchUser) as I had to change a number of SP Person or Group fields to text due to the bug with more than 12 lookup SP columns in Power Apps. Each time I save the same item it adds that first entry again and replaces any unchanged values with the same one on each re-save. Even better is the account appears blank in SharePoint so I just have commas showing.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (3,960)