web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / PowerApps: NewForm Fun...
Power Apps
Answered

PowerApps: NewForm Function

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello Community,

 

How NewForm function in PowerApps works? 

 

As per my understanding the function ignores Form Control's Item Property, and will take default values of form data source.

 

In my case, PowerApps --> Edit Form --> Set App Onstart() --> NewForm(Form1)

 

Set Sharepoint as datasource, Add 2 field 1 number[Set default value 0] and second date[default date today].

 

Add this 2 field in data source and run app. 

 

Form populate number field with default value 0 but it won't works on date field?

 

So how the function works?

 

Thanks,

Bansari Pandya.

 

Categories:
I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @Anonymous 

    You almost have it right.  NewForm() does not require that the Item property be populated because until the data is saved, there is no Item.  If you want to create a new record when the app starts, you could use the Patch() function instead of a form to create the record.  It would be Patch(SPlist, Defaults(SPlist),{numberfield:0, datefield:Today()). FYI, if you happened to close the app and reopen it the same day, you would create another record. 

  • Verified answer
    v-albai-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    What is the Item property of your Form1? Have you set its item property as “Defaults(SPList)”?

    Based on the information described in the Microsoft documentation, each field should be populated with its default value in NewForm():

    “In FormMode.New mode, the contents of the Form control's Item property are ignored, and the default values of the Form's DataSource property populate the form.”

    I did a test in my app, according to the conditions you provided, also set my Form’s Item property as “Defaults(Mylist)”. When I run my app, I meet the same situation as you: Number field is populated with default value 0, but date field isn't populated with today().

    Then I add a submit button: “SubmitForm(MyForm)” , then add a record, only fill in Title:

    v-albai-msft_0-1611108347345.png

    Go to my SP list, I found that the date of this record has been filled with the default value(today()):

    v-albai-msft_1-1611108347347.png

    Double check my form, I found that the value inside Date is a Placeholder, it is not a value populated by default value. When view the “InputTextPlaceholder” property of the date field, Text is set as a date value:

    v-albai-msft_2-1611108347350.png

    So set this property as below and everything is ok(just replace Date(2001,12,31) with Today()😞

     

    If(IsBlank(Self.SelectedDate), Text(Today(), Self.Format, Self.Language))

     

    Best Regards,

    Allen

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 413

#2
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#3
timl Profile Picture

timl 315 Super User 2026 Season 1

Last 30 days Overall leaderboard