Bug reports Found a bug? Post it here please.
Version 7.x > Bug reports > ItemCreatedBy is overwritten as null when record is modified. View modes: 
User avatar
Member
Member
Jerreck - 11/20/2013 9:40:39 AM
   
ItemCreatedBy is overwritten as null when record is modified.
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.

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 11/21/2013 1:06:40 AM
   
RE:ItemCreatedBy is overwritten as null when record is modified.
Hello Jerreck,

Thank you for your message.

I have tried to reproduce this issue but (un)fortunately when I edit the custom table item the ItemCreated and ItemCreatedBy are left unchanged in the database column.

I have modified those fields using CMS UI, are you changing them through API? Can you maybe post an example how are you changing them?

Thank you for any more information.

Kind regards,
Richard Sustek

User avatar
Member
Member
Jerreck - 11/22/2013 8:23:55 AM
   
RE:ItemCreatedBy is overwritten as null when record is modified.
My apologies, we've figured it out. It was in fact a piece of code that we were using to update a custom table through the API that was causing this issue.

I have tested our custom tables by editing them through the UI and they are working correctly.