54
Views
1
Comments
Audit Trail/Log

Hello,

I have a table, and every time I update one of it's fields, I want an audit trail old & new record with action type (Create, update, Delete).

I want to make an own logic in my app ( without using forge components)

I searched the forums and found this solution but I didn't understand exactly what I have to do after creating the entity, can someone explain a bit more or share oml please?

Thanks

2018-10-29 08-31-03
João Marques
 
MVP

Hi Mohamed,


If you want to capture the changes a database record has throughout time, you're going to need to save these changes. The solution you are mentioning suggests that whenever you update a record (e.g. a Patient name), you also create a record in the audit table.

Imagine a scenario where you have an entity Patient, and you have a record with the name John, but actually his name should be changed to Richard. According to this solution, you should:

  1. Update the record in Patient entity with name John to Richard
  2. Create a new entry in the log table where the entity is Patient, and the PreJSON is the record before the change (so named John), the PostJSON is the record after the change (so named Richard), when and by whom.

In this way, you will be able to go back to the audit trail and know who changed what and when, which is the purpose of the trail.


Kind Regards,
João

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.