KamoCRM

Auto-assign a MERS-compatible loan number at application creation

Featurekamo-shared-library
Shipped
3 ஆகஸ்ட், 2026 அன்று 1:43 AM UTC
Author
Kamo
Commit
b715c0a

LoanFile.loanNumber was null on create (both blank-create and lead-promote) and only ever set when a steward typed one — which hard-blocked MERS MIN minting (a MIN's 10-digit segment IS the loan number) and every downstream identifier for a headless-originated loan. AppMortgageService now assigns a loan number at both creation sites: a clean 10-digit numeric (MinMinter strips non-digits and needs a <=10-digit segment, so a pure numeric is the only safe shape), unique per org via the (org_id, loan_number) index with a bounded retry. It FAILS OPEN to null on a collision streak or an unavailable repo — degrading to the prior manual behavior rather than ever breaking application creation. A lender-supplied number still overrides via the loan-file patch path. No schema change (the column already exists, indexed).

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