How to store data in a variable in M-files

Hello, we need help, I would like to check if it would be possible to store data in a variable, each time it goes through a state in the workflow.
To explain better, we have to create a drawing error report, and each time it is corrected, record the reason for the error. The problem is that a drawing can go through this state several times, so we don't know how to archive this data for use them via the database

thanks