I've noticed in a custom table that the default fields of ItemCreatedBy and ItemCreatedWhen seem to have a counter-intuitive behavior whenever a record in the table is modified.
For every record in our custom tables that are modified, the ItemModifiedBy and ItemModifiedWhen fields are updated with the UserName of the current user (as it should) and the current system time of the server, but the ItemCreadtedBy and ItemCreatedWhen fields are set to null.
Why would the ItemCreatedBy and ItemCreatedWhen fields be set to null when a record is modified? Shouldn't these be left unchanged?
I stumbled across this issue while working on the same project mentioned in
this post.
In this project, I'm creating a custom report from a table that is used for tracking time, and one of the queries in the report returns a calculation of the sum of all the records in the Time field of this table where the ItemCreatedBy field matches a specific UserID.
However, I can't do that math if the ItemCreatedBy field is overwritten as null anytime a record is modified. I also can't use the ItemModifiedBy field because a different user can modify a record created by the original user.
I have a work around that I can use for now, but I figured this was something worth bringing attention to since it seems like bad practice to modify data that doesn't need to be modified.