PCE Transaction Create API
Purpose: create NetSuite transactions only. It does not create or update AP e-invoice records.
Script:
customscript_pce_rl_tx_create Call log:
customrecord_pce_tx_create_log (separate from customrecord_pce_ap_write_log)OAuth 2.0 token setup matches AP Write integration guide §1. The External URL is this script's own deployment.
Request
POST only. GET returns 1011 / PCE_METHOD_NOT_ALLOWED.
Do not send action, apInvoices, invoices, transaction.id, or any custbody_pce_ / custcol_pce_ field.
{
"requestId": "a1b2c3d4-e5f6-4789-a012-3456789abcde",
"transaction": {
"clientRef": "vb-001",
"type": "vendorbill",
"fields": {
"entity": "123",
"subsidiary": "1",
"account": "220",
"memo": "Vendor bill"
},
"expenseLines": [
{ "account": "610", "amount": 1050 }
]
},
"options": { "validateOnly": false }
}transaction is an object or an array of at most 10. type is vendorbill, expensereport, vendorcredit, or vendorprepayment.
requestId is 8–64 characters (A–Z, a–z, 0–9, -, _). The same id with the same body returns the previous result (0002). A different body returns 1005.
options.validateOnly: true checks the shape and does not save (0001).
A vendor bill may include purchaseOrderId plus itemLines[].orderline and quantity.
Response
Success uses returnCode 0000 and results[] with transactionId, transactionType, and transactionCreated. A mixed batch is success: false, partialSuccess: true, returnCode 0004. Created transactions stay saved.
Shape codes: 1002 action, 1006 AP invoices, 1008 type, 1012 transaction id, 1013 PCE fields, 1014–1017 purchase-order billing shape. Runtime errors are usually 4000; purchase-order transform failures are 4002 / 4003.