I am looking for a way to differentiate a record create (or insert if you will) from a record update within a trigger. I am not seeing anything that would allow me to do this easily. My use case is to send out an event on a record create and a different event on a record update. I want this to happen only after a successful write.
I can see on a pre-write how I could see if the record exists already or not, but then if the write should fail, I would have sent an event for the create or the update that is out of sync with the state of my database. I would like to avoid having 2 events sent on a create (one pre-write detecting a create and one post-write for an update).
It would seem to be an important piece of metadata that should be available to the trigger as to whether or not this record had to (or will) be created by the write.
Has anyone else already come up with an elegant solution or can point out the obvious thing I am missing?



