This is with reference with ticket number 93375 (deAsra foundation)
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.
- Download Custom Lead and List Actions connector from Apps Marketplace.
- Configure the same with lead grid row action customization.
- Create an action such as reject lead and in the callback URL paste a webhook code to post an activity on that lead.
- Write a webhook which is triggered on this custom activity post.
- When the webhook is tirggered, call https://apidocs.leadsquared.com/get-lead-by-id/ , https://apidocs.leadsquared.com/get-activities-of-a-lead/ and https://apidocs.leadsquared.com/retrieve-tasks-by-leadid/.
- Once all these 3 API have been called, call https://apidocs.leadsquared.com/lead-delete/
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.