KamoCRM

One mapping engine for lead imports, with team-member assignment

Featurekamo-shared-library
Shipped
October 6, 2026 at 6:35 PM UTC
Author
Kamo
Commit
dc93deb

Manual imports, automated (intake) imports and the backlog each carried their own copy of the mapping code, and they disagreed: date, regex and split transformations were missing everywhere, the intake copies skipped empty values before transforming (so "default value" never fired), several paths the canvas offers were dropped, and "Assigned User" was ignored on all three. leads.mapping is now the single engine: - LeadRequestMapper: rule list -> CreateLeadRequest. Mappings run in order and the first non-empty value per field wins; every leadFields.ts path, every mortgage field and custom form fields land (LeadRequestMapperTest pins it). - LeadFieldTransforms + TransformationsJson: every canvas transformation, one implementation; unknown types are refused at save time. - Assignment target "assignedTeamMember" (legacy "assignedUser" still read): a fixed member, unassigned, or matched from fields. Match fields form an ordered chain - a blank or unmatched value falls through to the next, the first that names one person decides, else the mapping's fallback (nobody or a chosen member) applies. Harmony's JustCall endpoint relies on that chain. - TeamMemberMatcher: format-tolerant, typo-safe matching on email, username and name ("Last, First", initials, nicknames, accents, one small typo); a value that fits two people is never guessed. - LeadAssignableMembers: the candidates are the active VIEW_LEADS holders, the same people the AgentSelector picker offers (RightHolders and GrantAllRoles move here from SecurityService so DaemonService can use them). Also: LeadImportResponse reports totalAssigned and assignmentIssues; LeadIntakeService validates transformations before replacing mappings and can requeue FAILED payloads for the intake job.

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