Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Highlighted
dsheaffe Trusted Contributor.
Trusted Contributor.
108 views

Notification rule where date field is blank

Jump to solution
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.
0 Likes
1 Solution

Accepted Solutions
PM Thompson Outstanding Contributor.
Outstanding Contributor.

Re: Notification rule where date field is blank

Jump to solution
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)
2 Replies
PM Thompson Outstanding Contributor.
Outstanding Contributor.

Re: Notification rule where date field is blank

Jump to solution
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)
markquah Absent Member.
Absent Member.

Re: Notification rule where date field is blank

Jump to solution
Just out of curiosity. Can this work?

Not Is Greater Than 1/1/1970

Cheers,
Mark
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.