Audit trail on Object Class

Hello!

Built-in Audit trail is on the roadmap, and will be a very nice feature (together with more support for listening to delete, update and create events on object classes, enabling a more event-driven architecture).

Until then, I have a quite simple suggestion, that may be implemented.

  1. An action taking one (or more) string parameters as input. In this case, just a string that is indented to hold the new value of all changed properties. The action should create the audit log entry to be stored in the database. In the below example, the name of that action is “Audit Log - Log Changes”
  2. A run code, creating that changeString as a summary of all changed properties (the diff between the new and the old object), and passing it to that action.

See screenshot, and put the following code (example) into the Run Code action node.
image

let output = ""

Object.keys(assignmentOld).forEach(function (key) {
  //check if that property of the new object is different than the original object. Ingore build-in properties, such as _S, holding the object state of this runtime data source.
  if ((assignmentOld[key] !== assignmentNew[key]) && key !== "_S") output += key + " changed to " + assignmentNew[key] + "\n"
});

log_changes({changeString:output})
    .then(() => console.log('logging done!'))
    .catch(console.error)

resolve()