j-riv@localhost:~$

netsuite-suitescript-automation

internal

Custom NetSuite SuiteScript automation for inventory operations, marketplace order handling, replenishment workflows, reporting, and business notifications.

TypeScriptOracle NetSuiteSuiteScript 2.xSuiteletsRESTletsMap/Reduce ScriptsScheduled ScriptsSuiteQLNetSuite Token-Based AuthenticationShopify
cat architecture.md

NetSuite SuiteCloud Runtime

  • Scripts are written in TypeScript and compiled to NetSuite-compatible AMD JavaScript.
  • Deployment is centered on NetSuite script records, script deployments, and File Cabinet uploads.
  • SuiteScript 2.x APIs provide access to NetSuite records, searches, runtime parameters, files, email, HTTPS, crypto, and background task submission.

NetSuite User Interfaces

  • Suitelets render internal NetSuite pages for workflows such as intercompany replenishment, retail replenishment, vendor bill processing, item lookup, invoice reprints, and reporting.
  • Client scripts add buttons, validate form interactions, collect selected transaction or item data, and improve NetSuite record workflows.
  • Portlet scripts expose dashboard shortcuts for reporting and item publishing workflows.

Business Automation Layer

  • User Event scripts update sales order fields based on marketplace channel data and normalize order metadata when records are saved.
  • Workflow Action scripts handle targeted transaction logic such as fulfillment notifications, order item adjustments, sales follow-up tasks, and product tracing flags.
  • Reusable custom modules encapsulate record creation, file attachment, transfer order creation, chat alerts, and error email behavior.

RESTlet API Layer

  • RESTlets expose JSON-based NetSuite endpoints for product lookup, customer lookup, lead and case creation, invoice printing, file attachment, user notes, open work orders, and marketplace fulfillment data.
  • RESTlet handlers validate required inputs before executing NetSuite searches or record operations.

Inventory And Replenishment Workflows

  • Suitelets and Map/Reduce scripts use saved searches and SuiteQL to find items that need replenishment, transfer, adjustment, or reporting.
  • Intercompany replenishment creates purchase orders from selected low-stock items after comparing source and target location availability.
  • Transfer-order modules create NetSuite transfer orders dynamically from calculated item quantities and source/target locations.

Background Processing

  • Map/Reduce scripts handle bulk work such as vendor bill payment creation, transfer order generation, inventory adjustments, buildable assembly calculations, notifications, and mass record operations.
  • Scheduled scripts run recurring operational checks for out-of-stock items, safety stock, late marketplace orders, apparel reorder points, location availability, and customer order reminders.
  • Summary stages and scheduled notification jobs send email reports after background processing completes.

NetSuite Data Model

  • NetSuite records are the primary data store, including items, sales orders, purchase orders, transfer orders, vendor payments, customers, leads, cases, invoices, files, and custom records.
  • Custom item fields, transaction body fields, transaction line fields, entity fields, CRM fields, custom lists, and reporting groups are also used by the scripts.
  • Notification workflows persist send and reset state in custom NetSuite fields or a custom item-notification record to avoid repeated alerts.

External Integrations And Notifications

  • Marketplace channel logic is evidenced for Shopify, Amazon, eBay, Walmart, TikTok, and Yelp-related workflows through user events and RESTlet filenames.
  • A Suitelet manages marketplace sync flags for Shopify and eBay item publishing fields.
  • Email notifications and an HMAC-signed HTTPS chat alert module provide operational visibility for failures, lead creation, inventory thresholds, and completed background jobs.
# Why use NetSuite-hosted scripts?
Keeping UI extensions, record automation, searches, and background jobs inside NetSuite lets the project operate directly against the ERP data model without a separate application server or duplicate database.
# Why combine Suitelets and client scripts?
Suitelets provide controlled internal workflows for operational users, while client scripts handle selection, button actions, and form behavior in the browser before server-side SuiteScript creates or updates records.
# Why use Map/Reduce for bulk work?
Inventory checks, transfer generation, notification resets, and vendor payment creation can touch many records, so Map/Reduce scripts fit the need for parallel processing, governance handling, and yielding.
# How is integration security handled?
RESTlet access uses NetSuite Token-Based Authentication, and outbound requests are signed with an HMAC secret stored through NetSuite API Secrets.
# How is notification noise controlled?
Notification scripts store send and reset state in NetSuite custom fields or custom records, allowing recurring checks to report newly qualifying items without repeatedly alerting on the same condition.