What Is the Best Object Callback for Insert Operations: %OnBeforSave(), %OnAddToSaveSet(), %OnAfterSave()
Hi!
I'm saving object instance using RestForms.
RESTFormsUI calls %Save() for me, which is great. But I want to set the property CreationDate with the current date for every new record being inserted.
So object callback implementation seems as a reasonable option. I did the following:
Method %OnBeforeSave(insert as %Boolean) As %Status [ Private, ServerOnly = 1 ]
{
if insert s ..CreationDate=$H
q $$$OK
}
And it works fine.
But Documentation says I'd better use %OnAddToSaveSet()
What are you using for the callbacks in similar cases?