If you want to model behavior in an event handler and the first thing you check is if the object is new or not. Then it is NOT an event handler.
Simply put the behavior of the event handler in you process logic and not as event handler. Especially a rest call in an event handler. Something I would never consider. As this is behavior you want to control and trigger other then in an event handler.
I think it depends if the creation of the object is triggered by a user.
If it is, then you might include the POST in your definition of created successfully. So the object can only be considered as ‘created successfully’ whenever the POST has been done successfully as well. Only commit the object after all required ‘operations’ for your object have been done and all of your validations have been passed. If not, then you can raise your error feedback to the user (which could be a failed POST).
If it doesn't, then I would say in the ACo like Tim van Steenbergen has mentioned in the answer above.
Hi François,
I’d expect this to be solved with an After create event handler on the entity. Are you facing any issues with this particular event handler?
Or have I simply misunderstood your question :) ?
Regards,
Radhika Wagle