Please enable JavaScript to view this site.

Navigation: Advanced topics > Events > Sample events > Database

Store the date and time when a record is modified

Scroll Prev Next More

 

To keep track of the time/date when records were last modified and who made the modification, you have two options:

1. Set the default value under 'Edit as' settings

To store the login name of the user who made the change, set the default value to:

 

XSession.Session["UserID"]

 

To store the modification date and time, set the default value to:

 

DateTime.Now

 

Note: Make sure to clear the AutoUpdate Value field.

2. Modify BeforeAdd/BeforeEdit events

Add the following code to BeforeAdd/BeforeEdit events:

 

values["DateUpdated"] = new XVar(DateTime.Now);
values["UpdateBy"] = XSession.Session["UserID"];

See also:

"Edit as" settings: Date

About Date Control API

Table events