How to create an automatic change log for a record?

I want to create a mini change log to display user edits to a record over time. For example, the user makes an upload then a week later edits one field. I want the publicly visible change log to reflect what field was changed. It would also be great to show the before and after value, but for now simply showing what field was changed and when would be great.

All of the fields in this custom data type are autobinding, so I was looking for a way to trigger a workflow every time the autobinding action happens, but I couldn’t figure that out.

Next I tried to find a way to scan the record for changes on page load and report those, but I can’t figure that out either.

Is this even possible?

Here’s a screenshot of the website with some annotations of what the change log might look like.

2 Likes

@nathanlively

Options set
Event
Display (text) (event1, event2, event3, etc)

Datatype
Log
Date (date)
Event (event)

Use the backend event “new database trigger event”
Set it to monitor the field you want
Set the action create a log and set date and event type
Set other backend flows as needed

Chart the logs via tables or chart elements

3 Likes

+1
You might also need a field to refer to the thing you are referring, too. Either save the Unique ID or if you only have one type of thing that it refers to, just a like to that thing.

3 Likes

Thanks cmarchan! At this point there are about 100 different fields in this record that I need to monitor. Will I need to create 100 different workflows or is there a trigger than can monitor ANY change?

I’d be interested to see solutions/best practices on this. In my case I’m not using autobinding – when I pull up a record for editing I have it populate all the input fields with the the record’s existing data, and when you change something and hit save, the workflow then saves all the values (changed or not) down to the record. To create a changelog, only way I know to do this is to have the workflow duplicate the record with existing data whenever someone hits save. So the existing database would have dupes (which I don’t like because I want the database as light as possible), or I create a shadow database which has the prior versions of records, and then create functionality to link the chains of record versions together.

1 Like

Did you try the database trigger events? Trigger Event - Bubble Docs
That’s how I got logging going in my app.

If you just set up a trigger event with no conditions it should handle that, no? But I would imagine this is not advisable.

1 Like

Thanks Rico. This looks like exactly what I need. My personal legacy plan does not support triggers, but I’m going to mark this as the solution anyway.

1 Like

Hi @rico.trevisan , do you create a new thing for each change that is detected or is there a slimmer way to handle this?

1 Like

Each event would be a new entry. Then it’s up to figuring out how much granularity you need. And remember, Bubble does have a logging system already.

Given the attempted change of pricing plans…

Thank you. This is more for users to track changes they’ve made. But it would be cool if you could somehow filter and format the bubble logs to provide them to the user… :thinking:

1 Like