cancel
Showing results for 
Search instead for 
Did you mean: 

Default values for a SharePoint Customize Form

Introduction
This blogs focuses on how to add defaults to a SharePoint Customized (or PowerApps) form. The list in this demo includes all the column types including managed metadata. The video walks you through the steps in detail, however, this blog with the attached text file contains all the functions incase you want to copy and paste
 
SharePoint list
Here is a screenshot of the SharePoint list, the column types and names used in this demo. You will have to modify the function to match your lists and column names.
 
picture1.png
 
Choice type field
 
picture2.png
 
Pick a date (for date only)
 
picture3.png
 
Pick a date and time
picture4.png
 
 
Lookup (The video shows you the list from which the lookup values are pulled)

picture5.png
 
Yes or No
 
picture6.png

Hyperlink
 
picture7.png

Managed Metadata
 
picture9a.pngpicture9b.png

Formulas
This contains the formulas used for the complex ones such as Choice type, User /Groups, Lookups and Managed
Metadata.
 
Choice type field
Example
 
If(SharePointForm1.Mode = FormMode.New,
LookUp(
    Choices('Add Defaults'.'Choice Type'),
    Value = "Device #1"),
Parent.Default
)
 
Users / Groups
Example

If(
    SharePointForm1.Mode = FormMode.New,
            {
                DisplayName: User().FullName,
                Claims: "i:0#.f|membership|" & User().Email
            },
            Not(IsBlank(DisplayName)),
    Parent.Default
)

Lookup
Example

If(
    SharePointForm1.Mode = FormMode.New,
    LookUp(
        Choices('Add Defaults'.lookup),
        Value = "Microsoft"),
    Parent.Default
)

Managed Metadata
Example
 
If(
    SharePointForm1.Mode = FormMode.New,
    LookUp(
        Choices('Add Defaults'.managedmetadata),
        Label = "IT"),
    Parent.Default
)
 
Video (This video walks you through the entire process step-by-step)
 
 

Conclusion
The formula's to add the default values is very similar to the formulas used in the Patch function. You can refer to the links below to see the two blogs I've written for the Patch Function.
 
Helpful Links
Comments

Is it realy possible to set Default Values on Managed Metadata Columns. I have a MMS Column (Single Value) named "bipBereich" in the SharePoint List "Incidents" and want to set a Default value "IT" only on FormMode.New:

 

On the DatacardValue i have set the

 

DefaultSelectedItems:
If(SharePointForm1.Mode=FormMode.New,LookUp(Choices('Incidents'.bipBereich),Label="IT"),Parent.Default)
 
In the NewForm first i got an error and no Default Value for my MMS ColumnPowerAppsManagedMetadataDefaultValueCanvas.pngPowerAppsManagedMetadataNewFormError.png

Hi @darogael ,

It's a very interesting post, thanks for that.

 

I have a issue with Managed Metadata and maybe you have the solution.

 

If(
SharePointForm1.Mode = FormMode.New,
LookUp(
Choices('Add Defaults'.managedmetadata),
Label = "IT"),
Parent.Default
)

 

Choices() only return first 20 entry and LookUp() is only searching into those 20 entry...
Do you have any magic trics to lookup in whole Managed Metadata ?

 

Boris.

Meet Our Blog Authors
  • PowerApps Community Mentor 2018, Practicing surgeon and former Professor of Surgery, University of Illinois, Chicago.
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 12 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • My name is Timothy Shaw and I create digital solutions using the Power Platform, Office 365, and Azure SQL and handle the IT for a small company in the energy sector. When not building the future :), I enjoy playing guitar, good (or really bad!) sci-fi, Xbox therapy, and hanging with my wife and son. Twitter: @ShortForTim