Table of Contents

Track When Records are Created and Updated

Lesley Updated by Lesley

Scenario

Your app has forms for creating and updating records, and you want to track when records are created and updated.

Recipe

Add a Date/Time Field to Store When the Record Was Created

In the Data section of the builder, select the table where you want to track when a record was created or updated. In this example, we've chosen the Events table.

Add a new "Date/Time" field using the field menu; we’ll call this “Date Created”:

When setting up your Date/Time field, notice this Date/Time field has a Default Date of "Current Date":

The default value is used in two ways:

  • Any form inputs will default to this value for forms that are adding new records.
  • When a new record is created, this default value will be used if a value is not provided.

This means that when a new record is created, the value for this field will default to the current date. This only works if you don't include this field as an input in your forms. Since the default only works for new records, this value will always store the date the record was created.

If you also want to track the time, select a time format, then select "Current Time" as the default time option.

Add a Second Date/Time Field to Store When the Record Was Last Updated

Repeat the process, by adding a second field called "Last Updated", also selecting the Date/Time field type and settings like above:

Add a Record Rule to Set the Last Updated Value From Your Form

Thanks to the default values, the "Date Created" field will always be set on its own whenever a new record is added. Since the default is only applied on creation, however, we need to add a record rule in any form that allows a record to be edited.

In the Pages section of your builder, select any page that contains a form used to "edit" your record.

Edit the form by clicking on it from the page view, then access the "Form Rules" via the lefthand panel.

Find the “Record Rules” tab at the top and add a new rule by clicking the “Add Rule” button. For every form submission, this rule is going to update this record and set the value of Last Updated Date to the current date.

The record rule should have the following properties:

  • Action: Update this record
  • When: Every form submission (no need to add any criteria for this scenario)
  • Values: Set "Last Updated" to the current date (this will also apply the current time, if enabled)

This rule will update the "Last Updated" value to the current date every time the form is submitted. Therefore, it will always store the last date the record was updated.

Notes & Troubleshooting

Make sure to repeat these steps and add record rules to any other "edit" forms where you want to track the date these records are updated.

This capability only applies to forms and is currently not available for changes made via inline editing on a grid.

How did we do?

Copy a Record Using Record Rules

Create a Version History for Records

Contact