KamoCRM

A lead that was ever assigned or opened can be deleted

Fixkamo-shared-library
Shipped
September 28, 2026 at 12:57 PM UTC
Author
Kamo
Commit
6f9bf99

LeadService.deleteLead cleared only lead_custom_form_data before deleting the row, and six other tables carry a foreign key onto leads(uid). Every assignment writes lead_assignments and opening the lead page creates its comment stream in media_session_post, so DELETE /api/security/leads/{id} answered 400 on fkhug3l97uoqa1b1algnw9f7r92 (SP06 T41) or fkm0uymim8px84ktn6h5kigkwia (SP11 T30) for nearly every real lead. LeadDeleteReferences lists every foreign key onto a lead table and how the delete releases it, one indexed statement each, keyed by the uid: - DELETE: lead_assignments, lead_custom_form_data, lead_los_links, webinar_lead_association (rows that only describe the lead). - DETACH (set NULL): lead_credits (a spent credit is money), media_session_post (the platform never deletes a media session), and for a mortgage lead **************** **************** builds the Hibernate model of every entity in the library and fails when a foreign key onto leads or a lead subclass table is missing from the list; the model matches production's pg_constraint as of 2026-09-28.

All changes

Like what you see shipping?

All of it arrives in your workspace on its own. Start on the free plan and read this page again in a month.

Start Free ForeverView Pricing