Audit Trail

Hi Team, I am Using Audit Trail Module. In My Orders Entity i have Lot of Fields which are not needed for End User.  When i pull Audit Report i get to See all Fields. Say In Order Entity i have 4 Fields –  Ordered By , Order Date, Order Status, Order Stage  For End User – He is Interested in seeing Auditing of Only 2 Fields –  Order Status and Order Stage.  When we pull Audit logs it comes for all 4 Fields. Is there a Way i can Show only Selective Fields Audit to End User ?
2 answers

That would depend how dynamic you want your filters to be. 

The most basic way is to add hardcoded XPath constraints to the LogLine for the member names.  Like this:



However, you need to update the constraint every time an attribute name is changed. Further, if you log lots of different entities, this becomes not only hard to maintain, but also you need to deal with ambiguities (i.e. if different entities have the same attribute names but you only want to show the status e.g. for Order, but not for a different entity, say Billing that also has an attribute ‘Status’).


A more dynamic way would be to use another filter entity that defines in runtime which member names are allowed and a data source microflow that retrieves the logitems based on the allowed attribute names. This could make use of the MxModelReflection module to retrieve the correct object and attribute names.




Note: the $ObjectName variable is required since the reflection module saves the name separated by ‘/’ while the Log saves the object name separated by ‘.’.

So $ObjectName = replaceAll($Log/LogObject,'.',' / ')


If you want the look and feel of the report page, but without some attributes, then duplicate the pages and snippets from Audit Trail Module to your module and add extra conditions to the data sources.