Possible to Automatically Insert Rows into Another Table without using a widget?

Based on all of my research and testing so far, it does not seem possible to automatically add/update/delete records based on some action/trigger, such as when a new record is added to a table.

I’m hoping this is in-fact possible somehow. If not, I would like to nominate this as a feature request which would unlock a lot of great functionality!

I have created shared a document to explain what I’m trying to achieve:
https://docs.getgrist.com/wdC9yriF7nkA/Attribute-Auto-Add-Testing-SHARED/m/fork

Summary of the Tables:

  • Cars - A list of cars and a summary of the required attributes that have been defined for each car
  • Car Attributes - A list of zero or more attributes that have been associated with a specific car from the Cars table.
  • Master Attributes - A list of possible attributes that can be assigned to a car, which get stored in the Car Attributes table. Each attribute can be marked as Is Required.

GOAL:

  • When a new car record is added to the Cars table, I want to automatically (without any user intervention) add records to the Car Attributes table that are associated with the car.
  • Attributes should only be added if Is Required is True in the Master Attributes table.
  • The default value of the attributes added can be a blank string (later, I could define a default value to use in the Master Attributes table for each attribute).

Is this possible to achieve in Grist as of today without using a widget (e.g., Action Button, Autoaction, PugPy)?

If not, my feature request would be something like:

  • Allow code in Grist (e.g., in Formula and Trigger columns) to modify data in the document (add, update, delete).
  • For example:
    • TableName.addRecord(Record)
    • TableName.updateRecord(id, Record)
    • TableName.removeRecord(id, Record)

Thanks!

1 Like