Power Apps Allow an Empty Selection within a Canvas App

Allow an Empty Selection within a Canvas App

-

The WHY:

The reason we customize a form is not only to give the end-user a better experience but because we are connecting to a data source and do not want to bother them with the technical details. When we are doing so, we need the form to be flexible in a way that doesn’t prepopulate forms unless we are explicitly choosing an option to be our default. Previously Power Apps prepopulated the default with the first option, and there were workarounds to this, but it wasn’t a clean solution to implement. The Allow Empty Selection, solves this problem, especially for when we utilize cascading dropdowns where the first drop down is crucial for showing the related options. 

The HOW:

Once your app is open and a drop-down selection is chosen, whether it’s in a data card native to SharePoint or drop-down connected to a CDS, the result is the same. By default, the form leaves the AllowEmptySelection as false, meaning that it’s turned off and chooses the first item in your list to be the default which leaves us with the undesired outcome in this scenario.

NOTE: I’ve been asked if the Combo Box component has this feature because we oftentimes use the drop-down and combo box interchangeably, however, it does not have this feature at this time.

For this use case we will use a standalone card not connected to a native canvas form in order to walk-through the entire process and cover more of the edge cases.

  1. NOTE: If this is a new app this step is critical and this may be covered. ALWAYS start out by saving your application as soon as you open it. After the initial save, it autosaves every 2 minutes. Without this step, it will not save until you have done so manually thus internet outage or interruption could cause headaches. Yes, I have been there! πŸ™‚
  2. Once the drop-down is added to the canvas, select it so that the control is active and showing the properties
  3. First, we will need to add a collection of items to the dropdown, erase “DropDownSample” and add copy and paste the following expression: [“Corporate”,”Branch”]
    1. This creates two choices, “Corporate” and “Branch”
    2. Link to Microsoft documentation regarding items dropdown choices, link here
  1. As you can see, the first choice by default is selected
    1. You can update the default by changing the Default property to another item within the expression
    2. At this stage, there is always a prepopulated defaulted selection
  1. Now when someone opens this form. They have already unknowingly made a selection because of this out of the box defaulted action. This has caused headaches in the past, especially when you are pulling these dropdowns from a list where there isn’t a blank option to default to.
  2. Ensure you have the dropdown selected and click the properties option and select AllowEmptySelection. Update this value from false to true.
    1. It is important that this is all lower case as Power Apps is case sensitive for true / false optoins
  1. Lastly, if you are still seeing a prepopulated defaulted option after updating the AllowEmptySelection value, save and refresh. This will reload the screen. Sometimes the functions get a little sticky, this being a notoriously sticky function.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Must read

Webinar (Presenter): Microsoft Ignite Briefing: Top Tech Announcements

Each year Microsoft highlights the latest and greatest developments in tech at...

Microsoft 2021 Ignite Briefing (Presenter): Top Tech Announcements

Each year Microsoft highlights the latest and greatest developments in tech at Microsoft Ignite and this year’s...

Latest news

A Day in the Life of a Power Platform Admin

https://www.youtube.com/watch?v=IjGmMKowexw&list=PLqKBietJFMF0TAigxQxMV7tsfUssWIoPJ&index=6 Join this session to walk a day in a Power Platform...

Maximize Your Dynamics Investment with Power Platform

Your Dynamics 365 investment provides your organization with a robust toolset to...

Productivity and Microsoft Viva

Curious about the future of SharePoint now that #MicrosoftViva has arrived? Take a closer look at Microsoft Viva, the...

Using Power Apps, Power BI, and Power Automate Together

Using Power Apps Power BI and Power Automate together can unleash huge benefits and enhance your solutions....

Must Read

Using Power Apps, Power BI, and Power Automate Together

Using Power Apps Power BI and Power Automate together can unleash huge...

Power BI Version Control – Ready to use solution

Power BI Version Control is a free, fully packaged solution that lets...

Connecting and using an On-Premise Gateway

The WHY There was a request to duplicate files...