cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
aaedla
Helper II
Helper II

Default value for combobox

Hi,

I have a combo box with Allow Search function to search users, and it's working as expected.

 

I am trying to set the default value when the app loads. Any suggestions on how to set up the default value for combo box?

 

I used below code to search users and results are as expected.

Items: Upper(Office365Users.SearchUser({searchTerm:ComboBox1.SearchText}).Mail)

 

I used below code to show selected users in view mode and it's working as expected.

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

 

 

Problem is, the combo box is showing some random value when the app loads in NewForm mode and this is happening because of DefaultSelectedItems code.

 

When I launch new form, I would like to show combo box as shown in pic(not with some random value)

aaedla_0-1627584904938.png

 

Any help would be greatly suggested.

 

Thank you

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

Hi @aaedla ,

 

You could use this formula on DefaultSelectedItemsproperty of your combo box control:

If(Your_Form_Control.Mode=FormMode.New,Blank(),Office365Users.SearchUser({searchTerm:Parent.Default}).Mail)

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

View solution in original post

1 REPLY 1
v-xiaochen-msft
Community Support
Community Support

Hi @aaedla ,

 

You could use this formula on DefaultSelectedItemsproperty of your combo box control:

If(Your_Form_Control.Mode=FormMode.New,Blank(),Office365Users.SearchUser({searchTerm:Parent.Default}).Mail)

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,405)