Home / Trust Hub / Case Studies / Wholesale Distribution / Regional Cold-Chain Grocery & Perishables Enterprise
Wholesale Distribution ยท X-Ray Rescue + Zero-Egress OCR

Cold-Chain NetSuite Script Rescue & Zero-Egress AP OCR Match

Executive Answer: A regional cold-chain grocery and perishables enterprise eliminated four active Stealth SuiteScript 1.0 production crashes, purged 46 duplicate _V_1_x File Cabinet scripts in a 96-hour scoped rescue (#ANON-508), and deployed a zero-egress Docker OCR pipeline with deterministic +/-2.0% PO-Receipt-Bill 3-way match. Architected under 13 years of NetSuite leadership (2013-2026), the fix halted Vendor Bill bottlenecks and unauthorized payment risk.
Engagement CodeDIST-TRACEABILITY-05Regional Cold-Chain Grocery & Perishables Enterprise
Verified OutcomeZero Script Crashes + +/-2% Auto-MatchMeasured Production Benchmark
Industry VerticalWholesale DistributionPrincipal Architect: Jeffrey 'Kyle' Castor
Calibration BasisM = 0.64Zero-PII Market Multiplier baseline

The Production Challenge

Years of ad-hoc patches left four Stealth SuiteScript 1.0 calls running inside 2.x headers on Purchase Orders and Item Fulfillments, crashing warehouse receipts during peak morning receiving. Meanwhile, 46 versioned _V_1_x script copies cluttered the File Cabinet, and AP clerks manually keyed hundreds of carrier and grower invoices every week without automated 3-way tolerance checks against Item Receipts.

DataOngoing Architectural Intervention

Triggered by a 5-day read-only Aissistor X-Ray (#ANON-508), DataOngoing executed a 30-day emergency Stealth 1.0 remediation (32h) followed by File Cabinet consolidation into strict SuiteScript 2.1 SDF bundles (64h). Simultaneously, we deployed our containerized internal: true zero-egress OCR stack (Qwen2.5-VL + Docling + DefendAir 4-layer sanitizer) feeding __do_rl_create_ocr_entries.js and a deterministic +/-2.0% 3-way match gate.

NetSuite Technical Stack & Governance Architecture

  • NetSuite Record Types: purchaseorder, itemreceipt, vendorbill, customrecord__do_ocr_entry, itemfulfillment
  • SuiteScript 2.1 Entry Points: Restlet (__do_rl_create_ocr_entries.js) · UserEventScript (Strict SS 2.1 Dispatcher) · MapReduceScript (Batch Charge & Match) · Suitelet (Variance Hold Review)
  • Core N/* Modules: N/record, N/search, N/query, N/file, N/error, N/format
  • Architecture Notes: Runs self-hosted vision OCR inside a Docker internal: true network with zero outbound LLM egress, SQLite SHA-256 binary deduplication, DefendAir prompt/ACH sanitization, and record.attach() RESTlet binding.

Verified Production Outcomes

  • Resolved 4 active Stealth SuiteScript 1.0 runtime crashes on Purchase Orders and Item Fulfillments within 30 days.
  • Purged 46 duplicate _V_1_x File Cabinet script artifacts into a clean, SDF-governed SuiteScript 2.1 repository.
  • Eliminated per-page cloud OCR SaaS fees using self-hosted internal: true Docker OCR inference.
  • Automated +/-2.0% 3-way match exception routing and blocked unauthorized vendor ACH bank-routing changes.

Before vs. After Benchmark Comparison

Stability & AP DimensionLegacy _V_1_x Clutter + Manual APDataOngoing SS 2.1 + Zero-Egress OCRVerified Production Impact
PO & Fulfillment Script Health4 active Stealth 1.0 crashes; 46 duplicate filesSingle SDF-governed SuiteScript 2.1 bundle0 runtime script crashes
Vendor Invoice Data PrivacyManual keying or cloud OCR SaaS uploadZero-egress Docker internal: true OCR100% private on-prem/VPC inference
PO <-> Receipt <-> Bill MatchManual line-by-line spreadsheet checkDeterministic +/-2.0% pre-validator queueAuto-approves compliant AP lines
Adversarial Invoice SecurityVulnerable to email/PDF bank-change spoofsDefendAir 4-layer ACH mutation blockerBlocks unauthorized bank-routing edits

What Is a Stealth SuiteScript 1.0 Crash and How Does an X-Ray Catch It?

Many NetSuite accounts carry legacy scripts whose JSDoc header was bumped to @NApiVersion 2.x without rewriting nlapiLookupField or nlapiSubmitRecord calls inside conditionally executed branches. They sit dormant until a specific edge case executes that branch and throws a fatal runtime exception. Our read-only X-Ray AST scanner flags every Stealth 1.0 call before production docks halt.

How Does Zero-Egress Docker OCR Protect Vendor Pricing and Financial Data?

Unlike SaaS AP tools that transmit proprietary supplier invoices and unit costs to external multi-tenant AI APIs, our OCR authority container runs Qwen2.5-VL and Docling on a Docker internal: true network with zero external internet egress. SHA-256 binary hashing prevents duplicate Vendor Bill creation across email, SFTP, and File Cabinet crawlers before the RESTlet runs record.attach().

How Does +/-2.0% 3-Way Match Routing Work Inside NetSuite AP?

Before posting a Vendor Bill, evaluate_three_way_match compares billed quantities and unit prices against linked purchaseorder and itemreceipt lines. Invoices within +/-2.0% route straight to AUTO_APPROVED, while outliers enter a VARIANCE_HOLD Suitelet queue. Review the full architecture in /patterns/zero-egress-ocr-three-way-match-authority/ and /after-the-xray/.

Interactive ROI Calculator: Zero-Egress AP OCR & 3-Way Match

Estimate annual AP labor hours and per-invoice processing costs saved by automating OCR intake and +/-2.0% 3-way matching.

Annual AP Hours Reclaimed (85% Auto-Matched) — Recalculates live from inputs above
Annualized AP Labor + SaaS Savings — Models 85% automated throughput via zero-egress OCR and +/-2.0% 3-way match plus elimination of 1.50 USD per-document cloud OCR tolls.

Explore Related Industry Hubs, Patterns & Sibling Case Studies

Frequently Asked Executive & Technical Questions

How does DefendAir stop vendor ACH fraud hidden inside PDF invoices?

DefendAir strips zero-width Unicode smuggling and white-on-white hidden prompt layers before LLM extraction, and hard-blocks any parsed invoice payload attempting to alter vendor bank or ACH routing records.

Can we purge duplicate NetSuite scripts safely without breaking hidden workflows?

Yes. Our X-Ray cross-references scriptdeployment, workflow, and systemnote execution logs over 12 months to prove zero active invocations before archiving orphaned _V_1_x files.

What document types besides Vendor Bills does the NetSuite DocAI RESTlet support?

Out of the box, __do_rl_create_ocr_entries.js and customrecord__do_ocr_entry handle Vendor Bills, Sales Orders, Batch Work Orders, 1099s, and Driver Licenses with automatic record.attach() PDF archival.

Ready to Eliminate NetSuite Bottlenecks & Recover Margin?

Engage Principal Architect Jeffrey 'Kyle' Castor directly for a fixed-fee read-only Aissistor X-Ray Diagnostic or milestone-bound implementation. Zero hourly billing games.

Schedule Executive Architecture Call Try 17 Live NetSuite Fix Consoles Call (844)-991-3648