How to update media field "LastUpdated" when ever the media is updated

Litium 8
How can we update the Media File Field “Last Updated” with “Datetime.Now” when ever the file is updated.

When I tried in the above code snippet. The validate function is getting called continuously.

Validation is done on creating, updating and deleting, so if you update something in the validation it will trigger another validation. You need to add an exit condition, maybe that the difference between LastUpdated and DateTime.Now is less than a defined period of time and in that case you do not update the file.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.