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 / Calendar Default Dates...
Power Apps
Answered

Calendar Default Dates Conditional Logic

(0) ShareShare
ReportReport
Posted on by

Hello,

 

I am working on an Engineering Support Request App. When the user submits a new request form, the date they created the request is captured by the Created column and I entered the following formula into the "Needed By" date picker control.

 

If(frmNewRequest.Mode = FormMode.New, DateAdd(Today(), 30), Parent.Default)

 

I have a number of other date pickers in the app for the assigned engineers to use. Since they are all tied to the ID of the existing request, I can't really use the FormMode.New logic. Examples include the date the work actually begins and the completion date. Other date picker controls may never be utilized such as "Date Placed on Hold" and "Cancellation Date". I want all of the date pickers to default to Today's date (versus 2001), but if I use Today(), the form won't retain any dates our engineers intentionally pick. How do I write an If statement for an Edit form that will address these needs?

 

Thanks in advance for your help,

Teresa

Categories:
I have the same question (0)
  • GarethPrisk Profile Picture
    2,828 on at

    You mentioned a 'new request form' - is this a Form control?

    If so, then you will want to update the following properties of each Date field's Data Card, that is tied to Date Picker control.

     

    Date Field Data Card (usually named like (Display Name)_DataCard1)

     

    Update property

     

    If(
     // Check Parent Form Mode
     Parent.Mode = FormMode.New,
     // New Form, Calculate Date
     DateAdd(
     DatePicker2.SelectedDate,
     30,
     Days
     ),
     // Not New Form, use shown values (this is what Data Card used originally)
     DateValue3.SelectedDate + Time(
     Value(HourValue3.Selected.Value),
     Value(MinuteValue3.Selected.Value),
     0
     )
    )

     

     

    Default property

    If(
     // Check Parent Form Mode
     Parent.Mode = FormMode.New,
     // New Form, Calculate Date
     DateAdd(
     DatePicker2.SelectedDate,
     30,
     Days
     ),
     // Non New Form, use record's value
     ThisItem.'Last Date Included in Campaign'
    )

     

     

    The gist of this is that we are making the Data Card (for the Date fields) show (Default property) and process (Update property) the values we want, based on the Parent Form's Mode. Otherwise, we will use the (presumed) source's column values and the controls from the form itself.

  • tagustin2020 Profile Picture
    on at

    Hello Gareth,

     

    Thank you for your response. I'm sorry I wasn't more clear. This app uses separate forms.

     

    There is one New Request form that only has the "Needed By" date picker. It is on a screen of its own. When the request is submitted, it appears in the gallery. When someone clicks the nav button to view details for the item, they are taken to a separate screen with a tabbed interface. Each tab has its own edit form based on the role of the person completing it. There are a lot of fields and some security trimming complexities that just make it easier to have 3 different forms versus one giant form where I attempt to show and hide things. All of the form entries are written back to the same SharePoint ID.

     

    The Request tab form only has the Needed By date. That is the only one that has a date buffer built into it.

    The Designer tab form has 3 date pickers that I want to default to today's date, but keep any dates that someone has intentionally picked from it.

    The Model Shop tab form also has 3 date pickers, same desired behavior as above.

     

    Does this change your recommendation?

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

    Hi @tagustin2020 ,

     

    The forms in three tabs are all in edit mode, And you want set the Default Date to Today, right?

     

    If so, I think it should set DefaultDate property to Today(), the Default Date won't effect the final selection from Users. At the same time, make sure the Update property of DataCard is set to DatePicker.SelectedDate, because the UPDATE property determines the value saved to the table.

     

    Does this make sense for your case?

    Sik

  • tagustin2020 Profile Picture
    on at

    Thank you for your assistance. I have applied these changes to my app. Have a great day! Teresa

  • tagustin2020 Profile Picture
    on at

    Hello Gareth,

     

    Thank you for this suggestion. I will save it for future reference. Have a great day!

     

    Teresa

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 529 Most Valuable Professional

#2
Haque Profile Picture

Haque 230

#3
Kalathiya Profile Picture

Kalathiya 217 Super User 2026 Season 1

Last 30 days Overall leaderboard