Button to view history of changes

I would like to put a button on a form to display a history of changes made to the specific record.

I created a ‘link’ button on the form and a link to app_log. The issue that I have is that the ‘key’ value is contained in the ‘description’ field of app_log - it is not a field that I can link to.

If the “Key” was actually a field in the log table, this is what I might use for my sql statement:
SELECT * FROM app_log WHERE application = “form_transdetail” and key=“transdetail_id” ;

I think I need to use sc_log_split to extract the ‘key’ value … not sure how to do that…

My other thought was to add a “key” field to the sec_log table (which would simplify things) but then I would have to modify every application to write to the log differently.

Has anyone else done something like this and if so - would you mind sharing your knowledge?

Thank you.

I have done something similar but as the logfile is design-wise completely different then the original table I made a different approach. I created a logtable for each record and in the onafterinsert/update I applied the current record into the new logtable. Actually the current actual record contains the latest user that made it, the logtable has all the records except the current. In this case users cannot delete, but only set the active record to ‘inactive’.