Role based entries in Changed Values for Advanced Audit Trail

0
Hi Everyone, We are using Advanced Audit Trail module for auditing in our app. We have a requirement to show the changed values of every attribute in an entity once it is committed. We have setup everything and is working fine. But there is one requirement, where these entries should be filtered based on the user role and hide certain entries to not show for certain users.The getMutation logic is not allwoing the same and since every thing is protected here, we can not have any customization.Can someone help here whether the ask is really possible and any solution on the same.RegardsAjay
asked
3 answers
0

Hi Ajay,


This is possible , but since the Advanced Audit Trail module is protected, you cannot change the getMutation logic directly.

A simple solution is to create your own microflow to retrieve the audit trail records instead of using the default one. In that microflow, you can add filtering based on the user role and only return the entries that the user is allowed to see.

Then use this microflow as the data source for your page.

This way, you don’t modify the original module, and you can fully control which audit entries are visible to which users.


Regards,

Reemali

answered
0

You can keep Advanced Audit Trail (AAT) as-is and introduce a new entity, for example ATTGeneralized, which generalizes from the relevant AAT audit entity. Then:


  • Configure read access rules on ATTGeneralized per your user roles.
  • Retrieve and display ATTGeneralized in your pages, so the audit entries are automatically filtered by role via entity access.


If this resolves the issue, please close the topic.


answered
0

hi,


Yes, this requirement cannot be achieved by modifying the getMutation logic in the Advanced Audit Trail module.

The Advanced Audit Trail module is protected by design, and the mutation logic used to generate changed values is not intended for customization or role-based filtering.

So filtering attributes directly inside Audit Trail processing is not supported.

Correct & Recommended Solution

The correct approach is:

  • Do not use the default Audit Trail pages
  • Create a custom page and apply role-based filtering while retrieving audit data

How to Implement

1. Use Existing Audit Trail Data

The module already stores changes in entities like:

  • AuditTrail.LoggedObject
  • AuditTrail.Change
  • AuditTrail.Attribute

You should reuse these entities.

2. Create a Custom Data Source Microflow

Retrieve audit records using a microflow instead of default logic.

Example idea:

  • If user role = Admin → show all attributes
  • If user role = Normal User → hide sensitive attributes

Example filtering:



AttributeName != 'Salary'
AttributeName != 'InternalNotes'
AttributeName != 'ConfidentialData'

3. Apply Role-Based Logic in Microflow



If $currentUser has role Admin
   → Retrieve all audit changes
Else
   → Retrieve filtered audit changes

4. Display Data in Your Own Page

Bind your page to the filtered list returned from the microflow.

Now:

  • Certain attributes are hidden
  • Role-based visibility works
  • Module remains upgrade-safe

What Should Not Be Done

  • Do NOT modify getMutation
  • Do NOT change marketplace module microflows
  • Do NOT edit Advanced Audit Trail core logic

This may break updates and is not supported by Mendix.

Final Conclusion

Role-based filtering of changed values is possible

But not inside Advanced Audit Trail internal logic

Correct solution = Custom retrieval + role-based filtering

answered