Structure fields automatic date field on update

Hey there… i have a structure with several fields… one is for “last update”, which i have to edit manualy to reflect when i was editing the last time this specific entry… i would like to automate this…

any idea on that?

p.s. it would also be very nice, if it’s possible to store the username of the loggedin user who was editing the entry… since we collaborate on this

I think your only option is a page.update:after hook where you have access the old and new page objects and can compare the before and after values, then update the entries that have been changed.

hmm… thx… but i think, those entries need unique IDs then?
Because: deleting, adding or moving an entry inside structure makes it impossible to compare the entries between oldPage and newPage?

Yes, if they don’t have unique number anyway(like a productcode or so, which could be even be something calculated from multiple fields in the entry, e.g in your example, “Haus” + “Wohnung” should probably be unique), then you would need unique IDs.