cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
svenvu
Advocate IV
Advocate IV

Why is there no AllowUnsetValue property for combobox to set a default blank value?

Hi

 

The AllowUnsetValue property of a regular dropdown is absolutely awesome. I found this secret property hidden on this forum and it can be used to set the default selected item in a drop down menu as a blank value when set to "true". Finally an easy solution that actually works! Thank you PowerApps-team!

dropdown blank value.PNG

 

Unfortunately there is no AllowUnsetValue property for a combobox (with single select in my usecase). Why is that? These are similar controls. Or does this have a different name for comboboxes?

 

I'm just looking for a way to display a blank value in a combobox when a new record has to be created in a gallery EditScreen while maintaining the default selected item when editting an existing record. But it seems like it's only one way or the other way and both can't go together, unless I would have something like the AllowUnSetValue 😮

 

My Items property for the single select combobox is:

'Office365-users'.SearchUser({searchTerm: ComboBox1.SearchText}).DisplayName

This gives me a beautiful list of all the employee names from the Office365-connector and the default value is blank which is what I want:

Combobox.PNG

 

My DefaultSelectedItems property for the combobox is: 

'Office365-Users'.SearchUser({searchTerm: Parent.Default}).DisplayName

This is necessary. Without this, the combobox is reset to blank when editting an existing record. The combobox however needs to be the selected item from the ViewForm. Now the behaviour for editting an item becomes correct but the behaviour for creating a new item becomes wrong. When creating a new record, the first employeename in the Office365-list becomes the default where I want this to be blank...

Combobox1.PNG

 

My Default property for the combobox is nothing at all

 

 

My Default property for the Gallery card is:

ThisItem.Emloyee

This is where the data is saved in a CDS table, lets say Table1, column Employee

 

My Update property for the Gallery card is:

ComboBox1.Selected.DisplayName

 

Question:

If the awesome AllowUnsetValue property doesn't exist for comboboxes, is there any workaround as the behaviour of my form is almost perfect, but actually not because when creating a new record, the first name of the Office365-list of employees is automatically selected Smiley Sad

 

Friendly greets

1 ACCEPTED SOLUTION

Accepted Solutions
svenvu
Advocate IV
Advocate IV

I found the solution thanks to Carlos:

https://powerapps.microsoft.com/en-us/blog/default-values-for-complex-sharepoint-types/

 

In the DefaultSelectedItems property from the combobox I had to enrich the formula with: If(EditForm1.Mode=FormMode.Edit;....;Blank()). So the formula needs to be:

If(EditForm1.Mode=FormMode.Edit;'Office365-users'.SearchUser({searchTerm:Parent.Default}).DisplayName;Blank())

 

Hopefully this is useful for other people searching for this 🙂

View solution in original post

1 REPLY 1
svenvu
Advocate IV
Advocate IV

I found the solution thanks to Carlos:

https://powerapps.microsoft.com/en-us/blog/default-values-for-complex-sharepoint-types/

 

In the DefaultSelectedItems property from the combobox I had to enrich the formula with: If(EditForm1.Mode=FormMode.Edit;....;Blank()). So the formula needs to be:

If(EditForm1.Mode=FormMode.Edit;'Office365-users'.SearchUser({searchTerm:Parent.Default}).DisplayName;Blank())

 

Hopefully this is useful for other people searching for this 🙂

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

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.

Users online (3,523)