Skip to main content

Integration Patterns

Every integration falls into one of these patterns. Find yours, understand when to use it, and get the code.


The Pattern Matrix​

NETSUITE INTEGRATION PATTERNS
─────────────────────────────────────────────────────────────────

NETSUITE'S ROLE
┌──────────────────┬──────────────────┐
│ ACTIVE │ PASSIVE │
│ (Initiates) │ (Responds) │
──────────────┼──────────────────┼──────────────────┤
│ │ │
OUTBOUND │ Pattern 1: │ Pattern 4: │
(Data OUT) │ PUSH OUT │ EXPOSE DATA │
│ NS → External │ External → NS │
│ │ (queries) │
──────────────┼──────────────────┼──────────────────┤
│ │ │
INBOUND │ Pattern 2: │ Pattern 3: │
(Data IN) │ PULL IN │ RECEIVE DATA │
│ NS ← External │ External → NS │
│ (fetches) │ (pushes) │
│ │ │
└──────────────────┴──────────────────┘

All Patterns at a Glance​

PatternDescriptionNetSuite RoleScript Types
Push OutNetSuite sends data to external systemsActiveUser Event, Workflow Action, Scheduled, Map/Reduce
Pull InNetSuite fetches data from external systemsActiveScheduled, Map/Reduce, Suitelet
ReceiveExternal systems send data to NetSuitePassiveRESTlet, Suitelet
ExposeExternal systems query NetSuite for dataPassiveRESTlet, SuiteTalk
File-BasedExchange data via SFTP filesActiveScheduled, Map/Reduce
MiddlewareUse middleware for complex integrationsN/AAny

Quick Reference: Which Script for Which Pattern?​

PatternScript TypeTimingUse Case
Push Out (Real-time)User Event ScriptafterSubmitSync on save
Push Out (Workflow)Workflow Action ScriptWorkflow triggerConditional sync
Push Out (Batch)Scheduled/Map-ReducePeriodicBulk export
Pull In (Periodic)Scheduled ScriptEvery X minutesPolling external API
Pull In (Bulk)Map/Reduce ScriptPeriodicHigh-volume import
Receive (Authenticated)RESTletOn-demandWebhook with auth
Receive (Public)SuiteletOn-demandWebhook without auth
Expose DataRESTlet / SuiteTalkOn-demandExternal queries NS

Decision Flowchart​

CHOOSING THE RIGHT PATTERN
─────────────────────────────────────────────────────────────────

Who initiates the data transfer?
│
├── NetSuite (Active)
│ │
│ ├── Data going OUT?
│ │ │
│ │ ├── Real-time? ──────▶ User Event Script
│ │ ├── Conditional? ────▶ Workflow Action Script
│ │ ├── Periodic? ───────▶ Scheduled Script
│ │ └── Bulk? ───────────▶ Map/Reduce Script
│ │
│ └── Data coming IN?
│ │
│ ├── Periodic fetch? ──▶ Scheduled Script
│ ├── High volume? ─────▶ Map/Reduce Script
│ └── On-demand? ───────▶ Suitelet (button)
│
└── External System (Passive)
│
├── Sending data TO NetSuite?
│ │
│ ├── Can do OAuth? ────▶ RESTlet
│ ├── No OAuth? ────────▶ Suitelet (public)
│ └── High volume? ─────▶ RESTlet + Queue + M/R
│
└── Querying data FROM NetSuite?
│
├── Custom logic? ────▶ RESTlet
├── Standard CRUD? ───▶ SuiteTalk REST
└── Legacy system? ───▶ SuiteTalk SOAP

Quick Reference: N/https Methods​

MethodUse Case
https.get()Fetch data from external API
https.post()Send data to external API
https.put()Update data in external API
https.delete()Delete data in external API
https.request()Custom HTTP method
https.get.promise()Async GET (non-blocking)
https.post.promise()Async POST (non-blocking)
https.requestRestlet()Call another NetSuite RESTlet
https.requestSuiteTalkRest()Call SuiteTalk REST API

Best Practices Summary​

PracticeWhy
Use https.post.promise() for outboundDon't block user transactions
Implement retry queueExternal systems fail
Validate webhook signaturesSecurity
Log all API callsDebugging & audit
Set timeoutsDon't hang on slow APIs
Use Map/Reduce for bulkGovernance limits
Store API keys in script parametersDon't hardcode secrets
Return fast from RESTletsQueue heavy processing