Creating a change log using webhooks

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered
I'm trying to understand the new web hooks feature that QuickBase has released. My understanding of scripting is pretty basic, but I've successfully set up a webhook in xml format to add a new record in another table whenever a record is modified.

What I am trying to accomplish is to create a change log in a log table whenever a line item record is modified or deleted. With the webhook I currently have set up, I can log if a record was modified or deleted using the %action% who modified it and when, and I can log those values in separate fields. However, I can't seem to post the actual change itself into the new log record. I'm not sure if this is because I am using XML, and that does not give me the response or if I do not know the correct command.

I've attached a screenshot of the webhook configuration as it stands now. Thanks! 
Photo of Todd


  • 170 Points 100 badge 2x thumb

Posted 3 years ago

  • 0
  • 1
Photo of Julie Sheffield

Julie Sheffield

  • 20 Points
There's a useful trick you can use both in webhooks and in email notifications: prefix a field name with "old." to get the previous value of a field when a record changes.  So if in your change log table, you have a text field in which you want to store the changes, you could add something like the following to your webhook, referring to whatever fields you want to track changes to:

<field fid="9">%repeatOn%Changed Description from [old.Description] to [Description]%repeatOff%</field>

Unfortunately, I don't know a way to only include the fields that have changed, but this can at least get you on the right path.

The %repeatOn% and %repeatOff% are in case records are changed in a multi-record operation, such as Grid Edit or Import. This approach would write all the changed records into one big field in your change log.  If instead, you want each changed record as its own entry in the change log, you could use API_ImportFromCSV instead of API_AddRecord.

Hope that helps!