Help! I am trying to work out how to have a notification rule that includes where a date field is blank. I have an update transition that sets a date field to the current date/time so want to be notified if that date has not been set.

I could add a binary field that also gets checked on the transition and use that for the notification rule but was hoping to avoid adding another field (albeit hidden) to the application.

Thanks in advance.

Accepted Answer

Tuesday, September 03 2019, 12:14 PM - #Permalink
I feel your pain. The Notification Rule comparitors for date/time fields are very limited:

  • Value Changes
  • Is Equal to (date/time value or keyword)
  • Is Greater Than (date/time value or keyword)
  • Is Less Than (date/time value or keyword)

It looks like the Rule processor doesn't consider any of these if the date/time field is blank / empty / DB NULL.

We use a binary/trinary value that reflects whether or not the date/time field contains something. That field is set when the form is submitted by a JavaScript function like the one below. It will detect almost all situations where a date/time field can be properly set, except where someone enters a numeric "0", which can't be differentiated from the field being the "(Auto)" value.

function DateTimeFieldIsSet(strFldName) {
return ( typeof(IsFieldEmpty("CLOSEDATE"))==="boolean" && IsFieldEmpty("CLOSEDATE")===false && typeof(GetFieldValue("CLOSEDATE"))==="string" && GetFieldValue("CLOSEDATE").length > 0 )
( typeof(IsFieldEmpty("CLOSEDATE"))==="number" && IsFieldEmpty("CLOSEDATE")===0 && typeof(GetFieldValue("CLOSEDATE"))==="number" && GetFieldValue("CLOSEDATE")===0 )
( typeof(IsFieldEmpty("CLOSEDATE"))==="boolean" && IsFieldEmpty("CLOSEDATE")===false && typeof(GetFieldValue("object"))==="string" )

FWIW ... My notes on how the JavaScript API treats date/time fields. It's a pain, maybe a defect, that the "IsFieldEmpty()" function sometimes returns a boolean and sometimes returns a numeric.

//    JavaScript processing of a Date/Time field on the form
// Field contents typeof(IsFieldEmpty()) IsFieldEmpty() typeof(GetFieldValue()) GetFieldValue()
// ------------------------- ------------------------- -------------------- ------------------------ ---------------
// cleared/empty "boolean" true "string" ""
// 1 or more blank chars "boolean" true "number" NaN
// numeric 0 "number" 0 "number" 0
// numeric -2 "boolean" false "number" -2000
// End_of_today (illegal) "boolean" false "string" ""
// * Startof_tomorrow "boolean" false "string" "Startof_tomorrow"
// * now "boolean" false "string" "now"
// * Selected value "(Auto)" "number" 0 "number" 0
// * 09/03/2019 12:00:00 AM "boolean" false "object" Tue Sep 03 2019 00:00:00 GMT-0600 (Mountain Daylight Time)
  • David Sheaffe
    2 weeks ago
    Thanks Paul. Looks like I will adding a binary field :(
The reply is currently minimized Show
Responses (1)
  • Accepted Answer

    Friday, September 06 2019, 04:28 AM - #Permalink
    Just out of curiosity. Can this work?

    Not Is Greater Than 1/1/1970

    The reply is currently minimized Show
Your Reply

Recent Tweets