How is your experience with the OutSystems Community?
21
Views
1
Comments
Identifying Changed Attributes from Before and After JSON in an ODC Audit Log Solutio

Hi Everyone,

I'm building a centralized Audit Log application in OutSystems Developer Cloud (ODC). 

Current Design 

To optimize write performance, I'm using two audit tables: 

  • Quick Log Table – Stores audit entries temporarily. 
  • Main Audit Table – A Timer/Background Job moves records from the Quick Log table to the Main Audit table for long-term storage. 

Is this a better approach than storing the data directly in main table.

For each audit event, I'm storing: 

  • Before JSON (entity data before the change) 
  • After JSON (entity data after the change) 

Requirement 

I want to identify exactly what changed between the two JSON payloads, such as: 

Before JSON JSON{  "Name": "John",  "Email": "john@test.com",  "Status": "Active"}

After JSON JSON{  "Name": "John",  "Email": "john.doe@test.com",  "Status": "Inactive"} 

Expected result: 

  • Email:  Old Value = john@test.com  New Value = john.doe@test.com
  • Status:  Old Value = Active  New Value = Inactive

Questions

  • Is there any built-in functionality in ODC to compare two JSON objects and return the changed attributes along with their old and new values? 
  • Are there any Forge assets, libraries, or reusable components available that can perform a JSON diff/comparison operation? 
  • What is the recommended approach for implementing field-level audit tracking in ODC when only the Before JSON and After JSON are available? 
  • Would it be better to: Calculate and store the differences at the time of logging, or Store only the Before/After JSON and calculate the differences on demand when displaying audit details?

Additional Context

The audit framework is intended to be reusable across multiple applications and entities, so I'm looking for a scalable and performant approach that can handle large volumes of audit records while still allowing users to see which fields changed and their corresponding old/new values.


Thanks,

Gowtham

UserImage.jpg
Francisco Franco

ODC has JSON serialization tools, but no built-in field-level JSON diff action. You can use DiffEntity for ODC, which compares two JSON objects and returns their differences. For the architecture, I would write directly to the main audit table unless performance tests prove it is a bottleneck. Store Before, After, and the calculated differences when logging, since recalculating every time the audit screen opens will become expensive at scale.

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