cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dudditz
Level 8

PowerApps User ComboBox Default Values

I have a powerapp with the following scenario.

PowerApp label field that contains project manager email, this is populated from an upstream process coming from Dynamics Projects.  

Combox that allows a user to search users within the organization and select multiple users.  My goal is to have this combox always default with two selected values including the email from the project manager field and the currently logged in user.  I have found a variety of posts that always reference sharepoint forms and sharepoint pickers however I am not using Sharepoint in this scenario.

 

The Combox is connected to the data source of Office365Users and configured as seen which allows the search of users and multiple selections.

If(Rule1, Office365Users.SearchUser({searchTermSmiley FrustratedearchUserCombo.SearchText}))

 

It seems that default items in a combox expects records and its not as simple as plugging the value of another text field.

 

There are downstream processes using flow that consumes the selected emails to perform various automations.

 

Any direction on this is greatly appreciated.

2 ACCEPTED SOLUTIONS

Accepted Solutions
mdevaney
Level 8

Re: PowerApps User ComboBox Default Values

@Dudditz 

Here's my suggestion for how to setup your ComboBox

DefaultSelectedValues property:

 

[
    Office365Users.MyProfileV2().displayName,
    Office365Users.Manager(Office365Users.MyProfileV2().id).DisplayName
]

 

DisplayFields property:

 

["DisplayName"]

 

SearchFields property:

 

["DisplayName"]

 

Items Property (make sure ComboBox1 is changed to your control name):

 

Office365Users.SearchUser({searchTerm: ComboBox1.SearchText})

 

I've tested the solution on my side and it appears to work.

 

---

Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly.  If your thought the post was helpful please give it a "Thumbs Up."

Highlighted
SaWu
Level 8

Re: PowerApps User ComboBox Default Values

Hi @Dudditz 

I didn't understand all of your post and I think there is some confusion with mixing up the default selected values and the Search Functionality.

On my side, I could get a ComboBox to work with Items

Office365Users.SearchUser({searchTerm: ""})

which is an empty Search yielding all users.
Thus, the ComboBox itself can choose any user, and you use the inherent ComboBox Search functionality to limit the number of displayed users.
image.png
As I see it, there isn't any point to using an extra TextInput control for Searching Users.
I have DisplayFields and SearchFields set to

["DisplayName"]

with DisplayName basically being the Fullname, which is thus used for display and for Search with the ComboBox.
To get the two pre-selected items I have DefaultSelectedItems set to

Table(Office365Users.MyProfile(), Office365Users.UserProfile("test@businesstobusiness.onmicrosoft.com"))

which is a table of the current user and the user specified with the test@... email.
In my test CRM those users two have Fullname "Christian Götz" and "Teo Test".
image.pngimage.pngimage.pngimage.png

Best of regards and luck,
    Sa.

3 REPLIES 3
mdevaney
Level 8

Re: PowerApps User ComboBox Default Values

@Dudditz 

Here's my suggestion for how to setup your ComboBox

DefaultSelectedValues property:

 

[
    Office365Users.MyProfileV2().displayName,
    Office365Users.Manager(Office365Users.MyProfileV2().id).DisplayName
]

 

DisplayFields property:

 

["DisplayName"]

 

SearchFields property:

 

["DisplayName"]

 

Items Property (make sure ComboBox1 is changed to your control name):

 

Office365Users.SearchUser({searchTerm: ComboBox1.SearchText})

 

I've tested the solution on my side and it appears to work.

 

---

Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly.  If your thought the post was helpful please give it a "Thumbs Up."

Highlighted
SaWu
Level 8

Re: PowerApps User ComboBox Default Values

Hi @Dudditz 

I didn't understand all of your post and I think there is some confusion with mixing up the default selected values and the Search Functionality.

On my side, I could get a ComboBox to work with Items

Office365Users.SearchUser({searchTerm: ""})

which is an empty Search yielding all users.
Thus, the ComboBox itself can choose any user, and you use the inherent ComboBox Search functionality to limit the number of displayed users.
image.png
As I see it, there isn't any point to using an extra TextInput control for Searching Users.
I have DisplayFields and SearchFields set to

["DisplayName"]

with DisplayName basically being the Fullname, which is thus used for display and for Search with the ComboBox.
To get the two pre-selected items I have DefaultSelectedItems set to

Table(Office365Users.MyProfile(), Office365Users.UserProfile("test@businesstobusiness.onmicrosoft.com"))

which is a table of the current user and the user specified with the test@... email.
In my test CRM those users two have Fullname "Christian Götz" and "Teo Test".
image.pngimage.pngimage.pngimage.png

Best of regards and luck,
    Sa.

Dudditz
Level 8

Re: PowerApps User ComboBox Default Values

Thank you both for your responses.  I was able to get this working using your reccomendations.

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 308 members 5,053 guests
Please welcome our newest community members: