cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Set combo box default item to the current user

Hi all,

 

I have another question. On the home screen of one of my apps the users search for and select themselves so they can record data about what work they're doing throughout the day.

 

The combo box is a standalone input field, so not part of a form. The items property is: Filter(Office365Users.SearchUser({searchTerm: Self.SearchText}), Department = "Corporate Resources, IBC").

 

I cannot figure out what piece of code to put in the DefaultSelectedItems property of the combo box.

 

I think it needs to be something like this(?): Filter(Office365Users.SearchUser({searchTerm: Self.SearchText}), Mail = User().Email).

 

The screen looks like this: 

freddiejoseph1_0-1615201967462.png

 

I have seen lots of posts about doing this using sharepoint as a datasource, but not the O365 Users connector.

 

Thanks,

 

Freddie

 

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

You're very close! This will work to default select the current user:

 

First(Office365Users.SearchUserV2({searchTerm:User().Email}).value)

View solution in original post

4 REPLIES 4
JR-BejeweledOne
Super User
Super User

You said:

I think it needs to be something like this(?): Filter(Office365Users.SearchUser({searchTerm: Self.SearchText}), Mail = User().Email).

 

Have you tried this?



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
timl
Super User
Super User

Hi @Anonymous 

You might find that just setting the DefaultSelectedItems property to this will work.

[User().Email]

 

Anonymous
Not applicable

You're very close! This will work to default select the current user:

 

First(Office365Users.SearchUserV2({searchTerm:User().Email}).value)
Anonymous
Not applicable

Thanks. This works perfectly!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,099)