Reputation: 3
Does anyone have a working example of a hook to update a document with a timestamp on update?
I was able to set the timestamp on record creation by using DEFAULT sysdate()
.
This doesn't help me when updating an existing record. Any advice would be appreciated.
Upvotes: 0
Views: 450
Reputation: 98
I'm sure the first answer is great but here's another option I wrote for myself. It takes a schemaless prop from your updating record to save the editing user, and could be extended to save the field being updated too.
Upvotes: 0
Reputation: 701
Ok. Check out this thread in GG. I posted a Javascript function, which does what you are asking for.
All you need to do is save what I came up with as a custom function then create the customer trigger property on your class. See this section of the docs on how to do that.
Scott
Upvotes: 0