This is with reference with ticket number 93375 (deAsra foundation)

Problem statement:

User is willing to delete few leads manually depending upon few conditions.

For this he is calling a webhook where the lead details are being saved in the request and then deletion activity is being operated.

He wishes to save the lead activities and tasks too yet API calls are failing as the lead is already deleted by the time the API is called.

Suggested solution:

So instead of directly clicking on delete lead in the activity column, the reject lead activity needs to be clicked on which shall automatically process the above mentioned steps and delete the lead with required back up.

Hope this helped.