Small Tricks and Tips : PowerApps – setting default value for the choice column

PowerApps form - "DefaultSelectedItems" - for choice field
PowerApps form - "DefaultSelectedItems" - for choice field

Hi All,

Today small tip regarding setting default value to SharePoint column in PowerApps form

Background

  • By default, SharePoint column default value is not getting in PowerApps forms
  • This means for example, even though we set default value for choice column in SharePoint list and we have customized PowerApps form then when we do new form default value does not appear in column or not pre-populate it
  • We have a choice column in our list and in form we are showing in Drop-Down Menu – Display choices using: property
SharePoint list - choice column settings
fig : SharePoint list – choice column settings
  • But after customised form in PowerApps, while creating new item default value is not appearing
New form - default value is not coming for column - Status - after customizing to PowerApp form
fig : New form – default value is not coming for column – Status – after customizing to PowerApp form

Workaround / Trick

  • Select the respective data card value control for our choice field we need to use the following formula for DefaultSelectedItems property
If(mysharepointform.Mode = FormMode.New, { Value: "MY DEFAULT VALUE" }, Parent.Default)

Here,
mysharepointform - name of the sharepoint form

In our case our form name - SharePointForm1

 PowerApps form - "DefaultSelectedItems" - for choice field
fig : PowerApps form – “DefaultSelectedItems – for choice field

In above code if our form is in edit mode then we are setting selected value otherwise we are setting default value – “Approved”

Now when we create “New” item default value will appear as

SharePoint List - New form - Default value for choice column
fig : SharePoint List – New form – Default value for choice column

Thanks !!! HAVE A GREAT DAY AHEAD!!!

Prasham Sabadra

LIFE IS VERY BEAUTIFUL :) ENJOY THE WHOLE JOURNEY :) Founder of Knowledge Junction and live-beautiful-life.com, Author, Learner, Passionate Techie, avid reader. Certified Professional Workshop Facilitator / Public Speaker. Scrum Foundation Professional certificated. Motivational, Behavioral , Technical speaker. Speaks in various events including SharePoint Saturdays, Boot camps, Collages / Schools, local chapter. Can reach me for Microsoft 365, Azure, DevOps, SharePoint, Teams, Power Platform, JavaScript.

You may also like...

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: