Skip to Content
0
May 24, 2020 at 04:10 PM

CAP after DELETE event handler - accessing the deleted entity

886 Views

Hi experts,

I was wondering if there is a way to access the entity deleted in an after DELETE event handler. When I debug the handler, the first argument the handler receives is undefined. This is probably very literally what the documentation says under

https://cap.cloud.sap/docs/node.js/api#service-after

However, I feel like having a reference/copy to the deleted entity (and its children on a deep delete) in the handler would be much more helpful, for example to implement follow-up actions that depend on properties of the deleted entity.

Is there a way to access deleted entities in an after handler? I can get the ID of the deleted entity out of the request, but that doesn't help really because obviously I can't use that to query the entity for its properties anymore.

Or do I have to implement the ON (deep) delete handler myself if I want to react to a deletion?

Best regards,

Manuel