Is there any way we can log audit trails for each user using the application?
For example: user1 makes changes to some table , I would like to log all previous and changed values.
I know I can use a DB trigger for that, but it won’t be aware of the user that made the change.
There is no built-in solution. You can use onBeforeProcessing server side event to log all necessary info, but it will require some custom coding.
Thanks, but can I get the info from connector somehow? Like get updated rows , inserted rows etc?
Connector can provide only id of the row which will be updated and new values ( all can be fetched through dataAction object, which id a parameter of onBeforeProcessing handler )
There is no way to fetch the data as it was before updating. ( you can always do it by cutom sql call )
Thanks a lot, ID and new values are enough, the old values can easily be found.
In any server side event, you will have “action” object as parameter, you can use
$action->get_id();
$action->get_value("field_name");
to get id or new value respectfully. ( above is PHP syntax, java connector has similar methods )