Announcements
I have a date field in the NewForm view that will serve as the date the form was submitted. I want this date field to be autopopulated to the current date and not change after the form is submitted. My logic is when the newform view opens and if the date field is blank, then set the date to Today(). I have the following formula as the DefaultDate:If(IsBlank(ThisItem.Date),Today())This appears to work in the PowerApps Preview and when I publish and play the app via a web browser but when I try to test the app on a device, the date is not populating to the current date. What am I missing?
Hi @PowerAid,
By doing so you're only populated the datefield when this one is blank.
You should try playing with the FormMode like this :
DatePicker.DefaultDate : If(Form1.FormMode=New,Today(),ThisItem.Date)
Theo
@tchin-nin wrote:Hi @PowerAid, By doing so you're only populated the datefield when this one is blank. You should try playing with the FormMode like this :DatePicker.DefaultDate : If(Form1.FormMode=New,Today(),ThisItem.Date)Theo
Hi Theo,
In regard to your suggestion, I don't understand where and what to type. Do I select the date field, then select the DefaultDate property dropdown and then type the following?
If(Form1.FormMode=New,Today(),ThisItem.Date
Yes exactly, you set this formula on the DefaultDate property of your datepicker control.
The formula says, if the form is a new item form, then set the date to Today(). If not (so if it is an Edit or a View form) set the date to the current item date (which will be the date saved when the item has been created).
If you don't want your users to change that date you can just hide the DataCard by setting the Visibile property to : false.
Théo
@tchin-nin wrote:Yes exactly, you set this formula on the DefaultDate property of your datepicker control.The formula says, if the form is a new item form, then set the date to Today(). If not (so if it is an Edit or a View form) set the date to the current item date (which will be the date saved when the item has been created). If you don't want your users to change that date you can just hide the DataCard by setting the Visibile property to : false. Théo
I follow you but it doesn't accept that syntax. My form name is FormGeneralInfoNS and I'm pretty sure it is in the New form mode. When I type: If(FormGeneralInfoNS it doesn't allow me to add a .FormMode right after that. What I mean is that .FormMode is not a suggested option as I try and add it. If i force it in the formula box, it will not accept it. The closest formula it will accept is: If(FormMode=New, Today(), ThisItem.date) Unfortunaltely, that does not produce a change of any kind.
Sorry you have to use
if(FormGeneralInfoNS.Mode=New,Today(),ThisItem.Date)
@tchin-nin wrote:Sorry you have to use if(FormGeneralInfoNS.Mode=New,Today(),ThisItem.Date) Théo
That worked! Thanks for the help. I'm a PowerApps newbie. Looking to use this to replace our InfoPath forms. Lots of learning ahead. Your help is much appreciated!
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.
Congratulations to our 2026 Super Users!
Congratulations to our 2025 community superstars!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
11manish 541
WarrenBelz 434 Most Valuable Professional
Valantis 289