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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Script Check if a date & time field is empty

(0) ShareShare
ReportReport
Posted on by

Hello,

I need to check whether a date & time field in the form I use is empty, and I need to do it with Java Script (it's necessary for a function I'm using, so business rules aren't an option).

I came up with this, but it isn't working (apparently, a date & time field isn't equaling null even though it appears to be empty):

if(Xrm.Page.getAttribute('new_dateandtime') == null) {...}

Does anyone know what an empty date & time field contains or could anyone help me in some other way? Thanks a lot!

*This post is locked for comments

I have the same question (0)
  • Verified answer
    tpeschat Profile Picture
    4,930 on at

    Hi.

    Try this code instead:

    var vDate = Xrm.Page.getAttribute('new_dateandtime').getValue();

    if (vDate == null) {

    }

    BR Thomas

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans