Follow my blog for more interesting topics on Dynamics 365, Portals and Power Platform. For training and consulting, write to us at info@xrmforyou.com
This one will be real quick. A small and effective one I should say. But before we go into the solution, let’s understand the problem statement here.
My customer have a canvas app built on Common Data service (CDS). The canvas app has an edit form for the contact entity. There is a date field on the Contact form.
You might have already noticed the issue here. This is the edit form for contact record. The date field is set to default value – 12/31/2001, if the field is empty. A close look at the DefaultDate property of the Date picker field reveal it is set to Parent.Default
Also if you observe carefully, the date is actually greyed out. It’s actually more of like a placeholder value but nonetheless annoying.
Recent Posts
- Improving User Experience with Delayed filter or Search in Power Apps
- {Solved} How to clear a DatePicker control in Canvas apps
- How to convert a local datetime to UTC in Power Apps
- PowerApps Tutorial: Extracting Dynamic JSON Schema Properties and Values
- How to get the Power Automate flow run id
In this blog, we are going to set the default date, in case the date field is empty, to today’s date. Let’s tackle these scenarios one by one. The first thing is to go ahead, select the data card for the date field and Unlock the data card to change it’s properties.
Once we do that, the next step is to select the date picker and set the DefaultDate property to the below formula.
Formula Text
If(IsBlank('Date field'), Today())
I set the field to Today’s date using Today() function if the field is blank. The below screenshot show the formula in action.
Simple and yet a requirement that pops up every now and then.
Hope this helps!
Debajit Dutta
(Business Solutions MVP)
Discover more from Debajit's Power Apps & Dynamics 365 Blog
Subscribe to get the latest posts sent to your email.