cancel
Showing results for 
Search instead for 
Did you mean: 
darogael

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
Anonymous

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.