How to create change logs.

I'm trying to create a logs table that shows user changes to fields on a table.  I'd like to be able to record the name of the column that was changed as well as the old value, and the new value.   The changes are made via quick edits to detail table or.  Is there any way to record these edits?

0 7 1,178
7 REPLIES 7

You could create an automation with an event that monitors for changes to the columns of interest and then executes actions to save in a separate log table the [_THISROW_BEFORE] and [_THISROW_AFTER] values along with any other information you want in the log entry.

Thanks for the reply.  It's my understanding that [_THISROW_BEFORE] and [_THISROW_AFTER] would work in a condition but they don't work in action inputs.  In other words they would work to fire the action but they don't collect the data.  Outside of forms and workflow templates, it doesn't seem that appsheet has any "BEFORE INSERT OR UPDATE" functionality for actions.  

That said, I could be wrong so please let me know if I am.

You are absolutely right. It is not possible to use "before" and "after" values โ€‹โ€‹except in the trigger itself. I keep a log, keeping the current state: "record created|modified: current field value"

Yes, that could be a limit in using AppSheet's data change actions. As @bonameblisto noted, you could still log the new value every time it changes so you'd always have a history of a row's values. The latest log entry would match the row's current values.

You could also leverage the availability of before/after values in templates and use the AppSheet API to create the log entries.

I'm not completely sure about that. I remember that the documentation even suggest you to use the Before and After values on templates to notify something like:


Dear Team123
UserName1 changed the job Job1 status from Pending to Completed


By using a template similar to this:


Dear <<[TeamName]>>
<<[UserName]>> changed the job <<[JobName]>> status from <<[_THISROW_BEFORE].[Status]>> to <<[_THISROW_AFTER].[Status]>>


Anyway, I'll test this since I haven't had the need before

PS: If it doesn't work, it doesn't make sense neither that [_THISROW_BEFORE] and _AFTER] are just for conditions

Yes this works but you have to create the automation for each column in a table. This method is good if you want to track few columns but for large number of columns this method is not feasible 

 

It is feasible to do if you create a webhook with JSON body. I have done with table that have 100s of columns.

Top Labels in this Space