Hi SF Team,
For all datetime data fields I have set up in the BOMapper "Return Alternate on Null/Set Null...." and NULL Replacement Value = #1/1/1900# (for smalldatetime data type)
Therefore as I understand this feature, when the field value is NULL when saving the record, it writes a NULL value back to the database and not 1/1/1900.
However, the BO object is writing 1/1/1900 back to the database and not the NULL value.
What I found when stepping through the BO logic using the debugger that if I don't set the value of the BO field to #1/1/1900# then the Set property within the BO code is never executed. Therefore, when saving the record, the Get property logic retrieves the 1/1/1900 value of the BO.field and writes it to the database.
So what I have to do is in the BO_BeforeSave event I have placed the following code:
if BO.DateTimeFieldName = #1/1/1900# then BO.DateTimeFieldName = #1/1/1900#
This piece of code forces the Set property of the field in the BO to execute. Now when the BO writes the value to the database, the Get property logic returns the NULL value and writes the NULL value back to the database.
This seems like a bug to me or am I doing something wrong in the BO Mapper configuration?
Thanks!