Home > Forum > Tips&Tricks > Get the "old" value of a changed field

Get the "old" value of a changed field
0

Hi there,

I have following idea and search for a solution:

I have an items list; now in case a certain field is changed, I want to write the "old" value before the change into a different column of this itemlist row.


Any ideas?

Kind regards,
Klaus

MVP

Hi Klaus,

my first ideas have been to always update the old value with the current one. This doesn't work if the field doesn't change but the workflow instance is saved.

At the moment I have two idea:

1. Requires JavaScript
The "Change" rule will execute a JavaScript rule, which retrieves the data of the workflow instance from the database.
Then the JavaScript would set the field to the value.

2.
The form rule set's another cell "Cell was changed".
During the save/path transition you can check which rows contain this information, get the value from the history table and reset the "Field was changed" value back to false.
I have here an example on retrieving the field value. You could use this as a starting point and amend this for the history of the item list.
https://daniels-notes.de/posts/2023/has-field-value-changed

Best regards,
Daniel