KamoCRM

LEADS_ASSIGNED email template; harden assignLead for bulk use

Featurekamo-shared-library
Shipped
22 ஜூலை, 2026 அன்று 8:23 PM UTC
Author
Kamo
Commit
c09cad2

assignLead had zero callers and had never run in production. Before wiring the bulk reassignment path to it, give it the guarantees that path needs: - take orgId and verify BOTH the lead and the new assignee belong to it, so a reassignment can't reach across tenants (reported as "not found" rather than "forbidden" so the error can't be used to probe foreign lead ids) - lock the row with findByUidForUpdate: a manual reassignment and a concurrent pool-accept target the same lead and would otherwise interleave into a lost update - clear the pool flags, mirroring CreditLeadAssignmentService. A lead marked for auto-assignment otherwise stays in the pool after being claimed by hand and gets taken out from under its new owner - publish chat routing, as updateLead already does, so the borrower's open live chat follows the lead instead of staying with the previous officer Also add the LEADS_ASSIGNED canonical template. The key must be in CANONICAL_KEYS or it can never be seeded and can never self-heal, and every send returns a permanent 404.

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