Entity edit history

0
TL;DR: I'm looking for a smart way to keep an edit history of an entity that has multiple associations of different types (1:1, 1:*, *:1). However, AuditTrial doesn't quite fit me What do I want to do? I want to be able to show the history of entity changes by the user and be able to call it up on the "History" page E.g. my entity has an association with another entity, which is a "dictionary" of properties. For the example, let's assume it is "New", "In progress", "Completed". Of course, there are many such datasets - both the object itself references a very large number of other entities and the object is referenced by other entities. What I want is to be able to show in the history that a specific user has made specific changes in this particular change (when saving changes to an entity). I have considered two options: AuditTrial and cloning. AuditTrial is not the right solution because it does not save the association only the values from these related entities together with all the other values of the related entity - this makes the project grow to a huge size if we have a lot of changes. In addition, it makes this other task more difficult: I would like to be able to show on a timeline how specific values from the dictionary have changed over time, e.g. searching for when an object ceased to be associated with "New" and became associated with "In progress". Cloning seems logical. I create a new object by cloning after a write attempt (as an entity event) and mark the previous, original object as a 'historical' object, then in the microflow I can compare the two objects and keep only the changed values in the historical one (clean up in the 'historical object' the values and relationships that are the same for both entities). Then on the page display only the changes comparing the older and newer version. By giving them consecutive numbers, I can show what change has occurred between version 4 and version 5, for example. However, the problem arises already at the stage of trying to clone because included in Community Commons: - DeepClone also clones related entities, and with this structure it means a cosmic size of the database and "crashing" the structure. - Clone stubbornly tries to change read-only values (e.g. System.owner) Do you have any way of creating such a history? Maybe it is worth trying a completely different way?
asked
2 answers
0

Hi Lukas,

Cloning is a nice idea.. 

I agree with the db size blow up due to audit trail. However I have a work around here , might not be the best solution but it's easy to do..

Create a  new entity say Entity B assuming the Entity for which you wanted audit is Entity A. Entity B- A would be 1-1 association ..

Create a string attribute  say C in the entity B  to store the associated values.. meaning every change in association will change the string C 

Do audit trail on entity B. 

On version of A report. Fetch associated B and it's audit and report it.

 

 

answered
0

I think the big question is: What are you using it for, and how can you make that easier?

 

Assuming it is mainly as a security fallback, what about:

Assuming every object would have a UUID,

generating a CSV or JSON string:

EntityName: {1}, Attr1 {2}, Attr2 {3} Association1 {4}, etc.

Any time an entity changes, you log who changed it, when, and the new values.

For historical purposes, you could see what entity changed and when, as for the relationships, that could also be logged via UUID. 

You would need something smart to extract and view it, but if it is for security fallback, this should work

answered