Access the deleted record in the "Delete" hook

Is there any way to access the deleted record’s id in the “After Delete” hook?

My project is “Bond”.
JS SDK on top of NestJs

1 Like

Hey @bond :wave:

Your should be able to access the filter and condition tree used to retrieve the records to delete in the HookHandler context (As visible here)

If you are dealing with a single record deleted, you should be able to retrieve the id of the deleted record.

As stated in the documentation, hooks are pretty low level in our API. The delete function does not expose the deleted records.
Depending on your use-case, and if you need a complete access to the set of records after they were deleted, I would suggest to use a smart action in this context, and block the “delete” operation at a role level. The agent API should be way simpler to use.

Let me know if that helps

1 Like

Thanks @jeffladiray
I’ve added a “Smart action” to the “doctor_to_specialty” collection, but it is not visible on the panel.
It would also be helpful to discuss the first solution.
I only could find context.filter.conditionTree. Its deeper properties (conditionObject.field) are not accessible.
Am I doing anything wrong?