Cold-Chain NetSuite Script Rescue & Zero-Egress AP OCR Match
_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.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: truenetwork with zero outbound LLM egress, SQLite SHA-256 binary deduplication, DefendAir prompt/ACH sanitization, andrecord.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_xFile Cabinet script artifacts into a clean, SDF-governed SuiteScript 2.1 repository. - Eliminated per-page cloud OCR SaaS fees using self-hosted
internal: trueDocker 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 Dimension | Legacy _V_1_x Clutter + Manual AP | DataOngoing SS 2.1 + Zero-Egress OCR | Verified Production Impact |
|---|---|---|---|
| PO & Fulfillment Script Health | 4 active Stealth 1.0 crashes; 46 duplicate files | Single SDF-governed SuiteScript 2.1 bundle | 0 runtime script crashes |
| Vendor Invoice Data Privacy | Manual keying or cloud OCR SaaS upload | Zero-egress Docker internal: true OCR | 100% private on-prem/VPC inference |
| PO <-> Receipt <-> Bill Match | Manual line-by-line spreadsheet check | Deterministic +/-2.0% pre-validator queue | Auto-approves compliant AP lines |
| Adversarial Invoice Security | Vulnerable to email/PDF bank-change spoofs | DefendAir 4-layer ACH mutation blocker | Blocks 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.
Explore Related Industry Hubs, Patterns & Sibling Case Studies
- Trust, Proof & 16 Case Studies Hub
- All 16 Anonymized NetSuite Case Studies
- Industry Hub: Wholesale Distribution
- Pattern: SEP Script Flattening & Async Map/Reduce (Pattern 01)
- Pattern: Zero-Egress OCR, +/-2% 3-Way Match & BOL Shield (Pattern 04)
- Case Study: Sub-Second Scale Capture & Zebra ZPL Pallet Labeling in NetSuite
- Case Study: 100% Automated FIFO Lot Allocation & Subrecord Repair in NetSuite
- Case Study: Recovering $140K-$320K in NetSuite Freight & Landed-Cost Leakage
- Launch 17 Live NetSuite Fix Consoles
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.