ワンクリックで
custom-process-transactions
Build custom NetSuite SuiteScripts that extend the Orderful SuiteApp's
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Build custom NetSuite SuiteScripts that extend the Orderful SuiteApp's
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Audit a customer's per-relationship outbound transformation rules at /v2/rules and flag any whitelist that's narrower than the partner's published spec. Run this BEFORE writing JSONata for a new outbound document type — misconfigured rules silently strip required EDI segments at send time, surfacing as "missing field" validation errors that NS-stored messages and /v3/validate both contradict. Use when the user says "audit the rules", "check outbound rules", "the post-fact validations show missing X but the message has it", "before we write outbound JSONata", or any time you're starting outbound work for a customer / partner / doc type that hasn't been validated end-to-end yet.
Author and iterate JSONata expressions that fix outbound EDI message validation errors for a specific customer × document type. Combines NetSuite SuiteQL lookups, the Orderful SuiteApp's JSONata engine, and tight reprocess loops. Use when the user says "write JSONata for the X transaction", "fix this 856/810/855", "the partner is rejecting on validation", "help me iterate on advanced mapping", or "the SF segment is wrong on the outbound 856".
Review a GitHub PR or the current feature branch against the orderful-netsuite-skills rubric. Invoke explicitly; not auto-invoked.
Diagnose and propose fixes for ITEM_LOOKUP_MISSING errors on inbound 850 purchase orders. Combines NetSuite item search, Orderful transaction context, and customer-specific matching conventions to propose a single, scoped lookup record for the contractor to approve. Use when the user mentions a failing 850, a missing item lookup, ITEM_LOOKUP_MISSING, or asks to map a partner part number to a NetSuite item.
Fetch structured per-transaction validation errors from Orderful (`dataPath`, `message`, `allowedValues`) instead of screenshotting the UI. Use when iterating on a partner-spec JSONata fix and a transaction is showing INVALID on Orderful, or when the user says "fetch validations", "what's wrong with that transaction", "/fetch-validations", "give me the errors for <txId>", "why is this 856/810/855 invalid", or asks to debug a partner-spec rejection without manual screenshots.
Safely inject a test inbound EDI transaction (e.g., 850, 855, 856) to Orderful and verify it routes to a sandbox SuiteApp instance — never to production. Looks up the right test ISAs from the Orderful relationship, confirms NS sandbox customer wiring matches, posts the transaction, then watches the polling buckets and immediately calls confirm-retrieval if the transaction lands in a prod bucket. After a clean sandbox landing, monitors the target NS for ingest and reports the resulting record state. Use when the user says "inject a test 850", "send a test transaction to sandbox", "test the inbound JSONata change", "let's mock a 945 from the 3PL", or any other "send a synthetic EDI transaction into our system without it touching prod" scenario.
| name | custom-process-transactions |
| description | Build custom NetSuite SuiteScripts that extend the Orderful SuiteApp's |
A "Process as Custom" extension is a SuiteScript that takes over from the Orderful SuiteApp's standard mapping for a specific (customer × document type) pair. Inbound, the SuiteApp drops the EDI payload on customrecord_orderful_transaction and waits — your script reads it, creates NetSuite records, and flips the status. Outbound, your script builds the payload and writes a new customrecord_orderful_transaction with Ready To Send; the SuiteApp's outbound MR picks it up and POSTs to Orderful.
/custom-process-transactionswriting-inbound-jsonatawriting-outbound-jsonataalternative-packing-sourceCustom scripts cost more to maintain than JSONata. Confirm with the user that JSONata can't do it before proceeding.
reference/900-series-lifecycle.md for the full Case-by-Case mapping. Don't assume.custrecord_ord_tran_message for this doc type. Either pull it from an existing Orderful Transaction in the customer's NS, or inject a synthetic one via inject-test-transaction and grab the staged payload. Without a real sample, the field paths (transactionSet.warehouseShipmentIdentification[0].depositorOrderNumber, etc.) are guesswork — every partner converts EDI to JSON with subtle shape differences and the SuiteApp passes that shape through unchanged.docs.orderful.com or the customer's Orderful Transaction Type page — the JSON contract Orderful expects you to produce). This is the source of truth: Orderful handles the JSON → EDI translation on its side. The trading-partner's EDI implementation guide is supplementary, useful for understanding required values and partner-specific qualifiers, but not the contract the script writes against.Try JSONata first. The SuiteApp's Advanced Mapping handles most simple transforms. Only escape to custom code when:
If the user hasn't tried JSONata, redirect to writing-inbound-jsonata / writing-outbound-jsonata and stop.
First, pick the right entity record for the doc series:
| Doc series | Entity | Also required |
|---|---|---|
| 800-series (810, 812, 820, 850, 855, 856, 865, 870, 875, …) | Customer record | — |
| 900-series (940, 943, 944, 945, 947, …) | Vendor record (the 3PL/warehouse) | A NetSuite Location set up for the 3PL, with the vendor linked. 945 fulfillment-creation needs this wired or the script can't resolve the target IF. |
Then, on that entity's record → Orderful EDI Customer Transactions subtab → enable the doc type → check Process as Custom. This sets custrecord_edi_enab_trans_cust_process = T. The label says "Customer" but the same subtab + field is used for vendors.
NS-1037 settings migration: "process as custom" now also resolves via a 3-value override (
custrecord_edi_enab_custproc_override,customlist_orderful_setting_override= Yes/No/Default) plus per-doctype subsidiary defaults (custrecord_orderful_sub_custproc_<doctype>, e.g._850/_855/_856/_810/_940/_943/ …), so the setting can be defaulted at the subsidiary per doc type. The legacycustrecord_edi_enab_trans_cust_processcheckbox is the bilingual fallback only when the override is unstamped — checking it on a single ETT still works.
customrecord_orderful_transaction with status transaction_status_pending_cust_process instead of being auto-processed.Ready To Send write instead of trying to generate the payload itself.If the entity record or (for 900s) the Location isn't set up first, configuration on the subtab won't be possible. Stop and have the user create those records before proceeding.
| Direction | Trigger | Script type |
|---|---|---|
| Inbound, batch | Saved search of pending Orderful Transactions | MapReduce (scheduled) |
| Outbound, on NS record save | e.g. SO saved → emit 940 | User Event (afterSubmit) |
| Outbound, batch | Saved search of fulfilled records → emit 945 | MapReduce (scheduled) |
| Outbound, workflow-driven | Approval-based send | WorkflowAction |
Every custom script in this pattern gets a sibling <prefix>_Orderful_lib.js. Do not skip this — it's where multi-script consistency lives, and it's the single biggest difference between a maintainable extension and a one-off.
What goes in the lib (frozen objects via Object.freeze):
TransactionBodyFields, TransactionLineFields, LocationFields, etc. So no script hardcodes a custcol_* or custbody_* ID inline.ScriptParams = { searchId: 'custscript_orderful_xxx_ss', testMode: 'custscript_orderful_test_mode', ... }. Single source of truth for parameter names.getStatusId(scriptId) (snippet in reference/record-types.md).getCompanyIsaID(), getIsaOverrides(), reading from customer/subsidiary records and the test-mode flag. Centralizes the live-vs-test ISA lookup that every outbound script needs.parseDate8 (CCYYMMDD), parseTime4 (HHMM), etc.getItemLookup() if the script does item resolution beyond the SuiteApp's built-in lookup.The lib means the script file holds business logic only.
/**
* @NApiVersion 2.1
* @NScriptType MapReduceScript
*/
define(['N/runtime', 'N/record', 'N/query', 'N/log', './<prefix>_Orderful_lib'], (runtime, record, query, log, lib) => {
// getInputData → { type: 'search', id: <searchId from script param> }
// map → load Orderful Transaction → JSON.parse(custrecord_ord_tran_message)
// → look up matching NS record → transform → create/update
// → set status to _success or _error
// reduce → optional, for aggregating by NS record key (e.g. one IF per SO)
// summarize → iterate map+reduce errors, log
});
Universal inbound saved-search shape. Every inbound custom-process script — 850, 812, 820, 944, 945, etc. — uses the same three-filter shape on customrecord_orderful_transaction. Only the doc-type value changes:
| Filter | Value |
|---|---|
custrecord_ord_tran_status | transaction_status_pending_cust_process |
custrecord_ord_tran_direction | 1 (Inbound) |
custrecord_ord_tran_document | the doc-type internal ID for this script |
This is the entire trigger contract. The SuiteApp lands inbound transactions for any (customer × doc-type) with Process as Custom checked at this status; your script's saved search filters down to the doc-type it handles.
In map, on success: record.submitFields to set status to transaction_status_success. On error: status to transaction_status_error AND populate custrecord_ord_tran_error with the message. Don't write to reduce on a map error — that keeps the source transaction retryable on the next run.
Your custom outbound script never POSTs to Orderful. It only stages a record. The SuiteApp's own scheduled MR (customscript_orderful_outbound_sending) is what actually calls the Orderful API.
What the custom script does:
record.load (UE).reference/record-types.md for which to use):
{ sender: { isaId }, receiver: { isaId }, type: { name }, stream, message: { transactionSets: [...] } }{ senderId, receiverId, type, stream, message: {...} }customrecord_orderful_transaction with: direction = 2, status = transaction_status_ready_to_send, custrecord_ord_tran_message = JSON.stringify(payload), ISA sender/receiver populated, test-mode flag from the script parameter.That's the full job. Once the record is saved at Ready To Send, control passes to the SuiteApp.
What the SuiteApp does (separately, on a schedule): customscript_orderful_outbound_sending runs on its own deployment schedule, queries for transactions at transaction_status_ready_to_send, POSTs each to the Orderful API, and flips the status to _success or _error (with custrecord_ord_tran_error populated on failure).
Verify the sending script is scheduled. In Customization → Scripting → Script Deployments → filter for customscript_orderful_outbound_sending:
Scheduled (not Not Scheduled or Testing)Ready To Send records pile up and nothing reaches Orderful. This is the most common "I built the script but nothing's sending" cause.SuiteScripts, create (or reuse) a folder named Orderful Scripts with a subfolder per doc type (945, 812, etc.). Upload the script and its lib.Released, log level Audit (or Debug for new scripts), set the role/audience.custscript_orderful_<purpose> (e.g. custscript_orderful_of945_ss for the 945 saved-search ID). Every environment-dependent ID — saved search, dataset, file, location, ISA — is a parameter. Nothing hardcoded in the script.N/file. Keeps mapping out of code.customscript_orderful_outbound_sending. Status must be Scheduled with a recurrence (every 5–15 minutes is typical). If it isn't, your custom script's Ready To Send records will pile up and never reach Orderful. This is a one-time per-customer check — but easy to miss when the SuiteApp was installed without the sending deployment ever being scheduled.inject-test-transaction to send a synthetic EDI doc → confirm it lands on customrecord_orderful_transaction with pending_cust_process → run the MR → verify the NS record was created and the status flipped to _success.customrecord_orderful_transaction was created with Ready To Send → wait for customscript_orderful_outbound_sending to run → verify status went to _success and the payload reached Orderful.Don't deploy to prod until sandbox is green.
*_Orderful_lib.js with field IDs, status helpers, ISA resolution, format helpers, and script-param keys. No exceptions — even one-script extensions get a lib.runtime.getCurrentScript().getParameter(). If you find yourself typing a numeric ID in a .js file, stop._success or _error. Else it stays in pending_cust_process forever and re-runs every cycle.reduce on map errors. Keeps the source transaction retryable. Writing partial output and then erroring causes double-creates on retry.map logic until you have a real custrecord_ord_tran_message sample for the doc type — pulled from an existing transaction or injected via inject-test-transaction. For outbound, refuse to draft payloads without Orderful's JSON schema for the doc type; partner EDI implementation guides are optional supplementary context, not the contract. Inferring field paths from doc-type names alone is guesswork and produces silent runtime failures.@NApiVersion 2.1. Prefer N/query (SuiteQL) over N/search for new lookups. Don't mix both modules in one script.reference/record-types.md — customrecord_orderful_transaction field map, customlist_orderful_transaction_status script IDs, the getStatusId SuiteQL helper, the Process as Custom customer-record toggle, X12 vs simplified outbound payload formats.reference/900-series-lifecycle.md — for 940/943/944/945 work: which NS transaction each doc reads from / writes to, the SO-cycle vs TO-cycle vs PO-IS-cycle variants, and which downstream EDI fires automatically. Consult before scoping any 9xx custom-process script.writing-inbound-jsonata, writing-outbound-jsonata — try these first.inject-test-transaction — sandbox validation for inbound.which-script-ran — scriptnote holds the customer's custom-process script logs too, not just the SuiteApp's: read them over SuiteQL by the customer script's scriptid. A stuck Pending-Custom-Process OT is diagnosed in the customer's script log — never in any customscript_orderful_* log.