Tracking Column Modifications in Grist – Is It Possible?

Hi everyone,

I’m exploring ways to implement a custom widget or alternative solution in Grist that tracks modifications in certain columns. Specifically, my goal is to have a mechanism where, when any of a set of columns is modified, a dedicated “UpdateTracker” column is automatically updated with the name of the column that changed.

For example, consider a table with these columns:

  • Name
  • UserName
  • Date
  • Email
  • Phone

Currently, the only solution I’ve found is to create an associated tracking column for each of these fields, so that each time one is updated, its corresponding tracker is updated with the column name (e.g., “Name” when the Name column is modified). However, this approach quickly multiplies the number of columns and clutters the table schema.

My question is:
Is it possible to create a custom widget—or use another mechanism (maybe leveraging Grist’s internal trigger system such as _grist_Triggers)—that can monitor these changes and update a single tracking column (or otherwise log the change) without needing to create separate tracking columns for each field?

I would appreciate any insights, sample code, or references to documentation that could help implement a more elegant solution.

Thanks in advance!

1 Like

AFAIK you could just create a dependency on the _grist_Tables_column meta table. For example, this formula: _grist_Tables_column.lookupRecords(tableId="Test") gets updated as it should when you create a column on the ‘Test’ table.

Hi,

For now I use the following formula which is triggered upon modification of the Last Modified automatic column. It joins multiple columns content in one single log.

import datetime
log=" ".join(f'[{w}]' for w in [$A, $B, $C])
ticket=Change_Identification.lookupOne(User=user.Name).Change_Identifier
current_time = NOW().strftime("%Y-%m-%d %H:%M:%S")
new_entry = f"{ticket}: ({user.Name}) {current_time} - {log}"
return (value + "\n" + new_entry) if value else new_entry

It looks like this but you can adapt as you like:

You’ll see I use a Change_Identification table to justify changes through a change ticket. My dream would be to make it mandatory before allowing any change with an auto-delete of the ticket identifier upon user logout…

However, for change tracking I think a better alternative would be to use the grist internal history but this is not possible for now.