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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

JS Script for an Alert if Date Field does not equal Today

(0) ShareShare
ReportReport
Posted on by 10

I have a Date field in our system, and Users just cannot get the date right... which 90% of the time should be Todays' date. But the other 10%... could be any date.

I would love to create a pop-up alert to warn Users that their date may be incorrect on change of this field.

Basically, if "Date_of_Service" <> Today(), create an Alert "The Date you entered is not Today's Date. Please confirm." 

But I don't want to do this On Save, because they still need the option to change or keep that value prior to saving. 

My other question is if I need to take into consideration the UTC time of "Today" in Dynamics. So if my User is in the East Coast or Hawaii, how do I determine "Today" as local?

Thanks in advance!

I have the same question (0)
  • Suggested answer
    Ioannis Vrasenikis Profile Picture
    Microsoft Employee on at

    Hi gsfortis,

    there are different approaches for this requirement.

    If you want to implement client side logic you can work with an "OnChange" handler, as your custom validation will kick in when the date value is changed and will run prior to any save action:

    docs.microsoft.com/.../configure-event-handlers-legacy

    OnChange Occurs when data in the column changes and the control loses focus.

    You can also consider having your validation done on Server side, where you can explore creating a plugin running on Pre-Validation stage. You can review below documentation to get familiar with the different events existing in the execution pipeline.

    https://docs.microsoft.com/en-us/powerapps/developer/data-platform/register-plug-in#event-pipeline-stage-of-execution

    Finally, for a low code approach you can also consider implementing business rules:

    https://docs.microsoft.com/en-us/powerapps/maker/data-platform/data-platform-create-business-rule

    Regarding your ask about the date and UTC, it really depends on your requirements.

    Depending on how the datetime behavior is configured for your respective date fields/columns, you may or may not need to do additional UTC calculation. Please review below documentation to understand more about the date time behaviors:

    https://docs.microsoft.com/en-us/powerapps/maker/portals/configure/behavior-format-date-time-field

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 Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 180 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 123

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans