Skip to main content
This walkthrough covers the common AR automation pattern:
  1. A NetSuite scheduled script finds inbound email/custom-record rows that need processing.
  2. NetSuite sends email metadata, body text, and optional file content to an Erstan OCR agent.
  3. Erstan extracts and validates the quote/order request.
  4. NetSuite polls for a structured result.
  5. NetSuite creates a pending quote/estimate or alerts a user when required fields are missing.
Create or install a published OCR quote-intake agent. Recommended form fields: The agent should be instructed to return JSON. A practical output contract is shown below.

Discover the OCR lane

Use the agent detail endpoint to confirm the lane ID, input schema, and attachment support.
If the response includes defaultLaneId, NetSuite can omit laneId when starting a run. If the agent has multiple lanes, send the selected lane ID in the run request.

POST with email body only

Use this shape when there is no attachment, or when the email body contains enough detail.

POST with optional attachment

Use attachments when NetSuite has an attached PDF, image, spreadsheet, or email body export. Each attachment needs name, type, and base64.
The public API request body limit is 25 MB. For larger files, store the file in a place the agent can access and pass a reference in input or metadata.

Poll until complete

Expected structured result

For automation, configure the OCR agent to return a single JSON object in finalResponse.

NetSuite scheduled script outline

Use idempotencyKey to make retries safe. A good key is the source custom record ID plus the attachment ID or last modified timestamp.
After polling returns completed, NetSuite can: This keeps the risky decisions visible while still automating the expensive OCR, parsing, and matching work.