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 / Auto Select End Date f...
Power Apps
Answered

Auto Select End Date field based on Start Date in Entity Appointment

(0) ShareShare
ReportReport
Posted on by 8

Hi PowerApp Experts, 

 

I have a created a canvas app connected to D365. On the Entity, Appointment, I want to have a scenario, where on select of Start Date, the End Date also has to be filled with the same date. However, this does not seem to work. 

 

OnChange of Start Date, I have written the following code. 

 

If(
IsBlank(EndDateValue.SelectedDate),
UpdateContext( {selectedDate: StartDateValue.SelectedDate} ); Set(selectedDate, EndDateValue)

)

 

Can you please support me here?

 

Thanks a lot

SN.

I have the same question (0)
  • LeeHarris Profile Picture
    1,026 on at

    Hi @SantoshNilla 

    If you set the DefaultDate property of your End Date field to the SelectedDate from your Start Date field (e.g. dte_StartDate.SelectedDate), any changes to Start Date should update End Date.

     

    2019-07-12_13-44-34.gif

     

    Hope that helps

     

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @SantoshNilla ,

    Based on the formula that you provided, I think there is something wrong with it.

     

    Actually, it is not necessary to initialize a variable to store the selected date value within the Start Date Picker control. Instead, you could bind the Start DatePicker control and the End DatePicker control directly.

    I have made a test on my side, please consider take a try with the following workaround:2.JPG

    set the DefaultDate property of the End DatePicker control to following:

    StartDatePicker.SelectedDate

    Please check the following GIF screenshot for more details:Test.gif

     

    If you want to store the selected Date value in your Start DatePicker control into a variable, please take a try with the following workaround:

    Set the OnChange property of the Start DatePicker control to following:

    Set(SelectedDate, StartDatePicker.SelectedDate)

    Set the DefaultDate property of the End DatePicker control to following:

    SelectedDate

    Please consider take a try with above solution, then check if the issue is solved.

     

    Best regards,

  • Santosh Nilla Profile Picture
    8 on at

    Hi @LeeHarris @v-xida-msft 

     

    Thanks for your responses. Really appreciated. 

     

    I already tried this out and it works. However I guess I missed to inform you a very important criteria, where it the problem actually arises.

     

    The start date should be copied to end date only if the end date is not yet selected. 

     

    When trying to use the IsBlank function, I am getting a cyclic redundency error. 

     

    Thanks for your support, 

     

    SN.

  • LeeHarris Profile Picture
    1,026 on at

    Hi @SantoshNilla 

    I think I have managed to get this working to meet your requirement.

    For the purposes of this example I have two date fields, dte_StartDate and dte_EndDate.

     

    dte_StartDate properties

    DefaultDate: Today()

    OnChangeIf(IsBlank(dte_EndDate.SelectedDate),UpdateContext({DefaultEndDate:dte_StartDate.SelectedDate}))

     

    dte_EndDate properties

    DefaultDateDefaultEndDate

     

    You may also wish to have a "Reset Defaults" button that has an OnSelect value of UpdateContext({DefaultEndDate:Blank()})

     

    Hope this helps.

     

     

     

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

    Hi @SantoshNilla ,

    I have made a test on my side, please take a try with the following workaround:

    set the OnVisible property of the current screen to following:

    Set(SelectedStartDate, Blank());
    Set(IsEndDateBlank, false)

    Set the OnChange property of the Start DatePicker control to following:

    Set(
     SelectedStartDate,
     StartDatePicker.SelectedDate
    );
    If(IsBlank(EndDatePicker.SelectedDate), Set(IsEndDateBlank, true), Set(IsEndDateBlank, false))

    Set the Default property of the End DatePicker control to following:

    If(
     IsEndDateBlank = true,
     SelectedStartDate
    )

    Please consider take a try with above solution, then check if the issue is solved.

     

    Best regards,

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @SantoshNilla ,

    Have you taken a try with the solution I provided above?

    Have you solved your problem?

     

    If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has been solved.

     

    Best regards,

  • Santosh Nilla Profile Picture
    8 on at

    Hi @v-xida-msft 

     

    I was able to perform the similar steps and I got it working.

     

    Thanks a lot for your your support, @v-xida-msft  & @LeeHarris . Really appreciated. 

     

    SN.

  • AnchorSolution1 Profile Picture
    2 on at

    I have a start date (DataCardValue40.SelectedDate) and an end date (ThisItem.Einddatum). 

    Just add this line the default value on end date

     

    If(IsBlank(ThisItem.Einddatum) And !IsBlank(DataCardValue40.SelectedDate);DataCardValue40.SelectedDate;ThisItem.Einddatum)

  • anandkalpe18 Profile Picture
    2 on at

    I need to include time also in both the fields, But unable to change it in end date field. Is there any solution for it?

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 525 Most Valuable Professional

#2
Haque Profile Picture

Haque 273

#3
Kalathiya Profile Picture

Kalathiya 232 Super User 2026 Season 1

Last 30 days Overall leaderboard