How to loop/traverse all attribute from a record

Hi, I have a use case of record modification audit trail, where I need to show old and new record with changed fields highlighted.

I'm thinking to encapsulate this logic so I can use it in every data input screens.

To avoid hard coded attribute's value matching, I'm thinking to loop/traverse all attribute from a record-type variable.

Is it possible?

Maybe you can use SQL in an Action to retrieve the column names of a table?  I've gotten the following SQL for MS SQL Server from stackoverflow:

WHERE TABLE_NAME = 'Customers'

I am well aware that I can use database dictionary/metadata query to do that, but I am curious if Outsystems can loop/traverse attribute as well. :)