cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Impactful Individual
Impactful Individual

Syntax for ComboBox.DefaultSelectedItems

Please be so kind as to read my full post before replying.
Thank you for your consideration.

I am connecting to a Dynamics 365 MultiSelect OptionSet field, named kk_multiselect_ab on a custom entity producing the PowerApps/CDS data source 'MesseApp-Leads' and display/edit it with a Combo Box with control in a Form.
I am trying to pre-select some options by default.
Thus, I am trying to set the Combo Box property DefaultSelectedItems manually.

I have set Items to

Choices('MesseApp-Leads'._kk_multiselect_ab_label)

and DefaultSelectedItems to

[First(Choices('MesseApp-Leads'._kk_multiselect_ab_label)).Value]

This shows no errors on the PowerApps Side and the ComboBox looks as if it accepts this.
image.png

But, when I try to submit this back to dynamics, the entries for _kk_multiselect_ab_label are not accepted
image.png

I have tried leaving DefaultSelectedItems blank and choosing the same value manually in Preview Mode.
This works.
I have tried using an additional ComboBox to manually choose options in Preview Mode and ComboBox.DefaultSelectedItems to

ComboBox2.SelectedItems

This also works.

My question:

  1. What is the proper Syntax/Semantics/Code/etc for DefaultSelectedItems of a Combo Box if I want, say, the first 2 options in Items to be selected by default?
    And, of course I want Dynamics 365 to no reject this.
  2. Is there a way to show/retrieve the full error message, which might contain more information, but is currently only the limited text in the dialog shown in the screenshot, from a small red X next to the buttom triggering SubmitForm/Patch.
  3. I have whitespace/space in some of the options, as seen in the screenshot of the working combo box. Might this be related to the encoding of this space?
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Impactful Individual
Impactful Individual

Re: Syntax for ComboBox.DefaultSelectedItems

I found a workaround, using something along the lines of

Filter(Choices('MesseApp-Leads'._kk_multiselect_ab_label), Value in
[Last(FirstN(Choices('MesseApp-Leads'._kk_multiselect_ab_label), 1)).Value,
Last(FirstN(Choices('MesseApp-Leads'._kk_multiselect_ab_label), 2)).Value])

for DefaultSelectedItems, which seems to work in all my instances.
I have no idea why using Filter works while using the Value table table directly doesn't.

View solution in original post

1 REPLY 1
Highlighted
Impactful Individual
Impactful Individual

Re: Syntax for ComboBox.DefaultSelectedItems

I found a workaround, using something along the lines of

Filter(Choices('MesseApp-Leads'._kk_multiselect_ab_label), Value in
[Last(FirstN(Choices('MesseApp-Leads'._kk_multiselect_ab_label), 1)).Value,
Last(FirstN(Choices('MesseApp-Leads'._kk_multiselect_ab_label), 2)).Value])

for DefaultSelectedItems, which seems to work in all my instances.
I have no idea why using Filter works while using the Value table table directly doesn't.

View solution in original post

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (12,363)