To have LightSpeed automatically store the time when entities of a particular type are created and updated, select the entity and set Track Create Time and/or Track Update Time to true.
The Track Create Time option creates a field named CreatedOn. LightSpeed automatically populates this field when the entity is first saved. You can access this field normally and use it in queries.
The Track Update Time option creates a field named UpdatedOn. LightSpeed automatically populates this field whenever the entity is saved. As with CreatedOn, you can access this field normally and use it in queries.
The database must contain the corresponding backing columns for whichever options are selected. If you use Update Database or Create Migration in the designer, it will create these columns for you. If you create these columns manually, they must be non-nullable columns of date-time type.
To have LightSpeed automatically store the user who created or last updated entities of a particular type, add CreatedBy and/or UpdatedBy string fields to the entity, and set the LightSpeedContext.AuditInfoMode.
If AuditInfoMode is set, LightSpeed automatically populates the CreatedBy field when the entity is first saved, and automatically updates the UpdatedBy field each time the entity is saved. Like the timestamp fields, you can access these fields normally and use them in queries. You should normally mark the fields as Load Only so that application code does not try to modify them.
For compatibility reasons, the CreatedBy and UpdatedBy fields are not used for automatic storage by default: you must enable the policy through the AuditInfoMode.
Because different applications identify users in different ways, the user id written into the CreatedBy and UpdatedBy fields depends on the AuditInfoMode. See below for further information.