Create Purchase Order with Line Items
Creates a new purchase order in NetSuite with line items. This action allows you to programmatically create purchase orders for vendor procurement with detailed line item information.
Overview
- Purpose: Create purchase orders in NetSuite for vendor procurement and inventory management.
- Use Cases: Automated procurement workflows, inventory replenishment, vendor order management, supply chain automation, integration with procurement systems.
- API Method: POST /purchase-orders
- NetSuite API: Uses NetSuite REST API
/purchaseorderendpoint. - Authentication: Requires NetSuite Token-Based Authentication (TBA).
Required Input Fields
Vendor: Object containing vendor information with NetSuite vendor ID in custom fields.
Purchase Order Line Items: Array of line item objects, each representing a product/item to be ordered.
Vendor Configuration
- Custom Fields: Object containing vendor metadata.
- NetSuite Vendor ID: Required field ‘netsuite-tba_id’ containing the vendor’s internal ID in NetSuite.
- Format:
{ customFields: { 'netsuite-tba_id': 'vendor_internal_id' } }
Line Item Configuration
- Product: Object containing product information with NetSuite item ID in custom fields.
- NetSuite Item ID: Required field ‘netsuite-tba_id’ containing the item’s internal ID in NetSuite.
- Quantity: Number of units to order (optional but recommended).
- Unit Price: Price per unit (optional - can be derived from NetSuite item record).
- Amount: Total line amount (optional - calculated as quantity × rate if not provided).
Line Item Details
- Item Reference: Each line item must reference a valid NetSuite inventory item, non-inventory item, or service item.
- Quantity: Number of units to purchase. If omitted, NetSuite may use default values.
- Rate vs Amount: Specify either rate (unit price) or amount (total). NetSuite calculates the other based on quantity.
- Description: Optional description for the line item (pulled from item record if not provided).
Advanced Line Item Fields (Optional)
- Location ID: NetSuite location/warehouse where items will be received.
- Department: Department code for accounting allocation.
- Class: Classification code for reporting and segmentation.
- Create Work Order: Boolean to automatically create work orders for assembly items.
- Inventory Detail: Object containing bin numbers, serial numbers, expiration dates for lot/serial tracked items.
Output
- Purchase Order ID: NetSuite internal ID of the created purchase order.
- Format: Returns
{ id: 'internal_id_string' }. - Usage: Use this ID for subsequent updates, approvals, or receiving operations.
NetSuite ID Requirements
[!IMPORTANT] Vendor ID: Must be the internal ID of an existing vendor record in NetSuite.
[!IMPORTANT] Item IDs: Must be internal IDs of existing item records in NetSuite.
- ID Discovery: Use NetSuite syncs or searches to discover internal IDs for vendors and items.
- ID Format: Internal IDs are numeric strings (e.g., ‘12345’).
Purchase Order Status
- Default Status: Purchase orders are created in ‘Pending Approval’ or ‘Pending Receipt’ status by default.
- Status Control: Status is determined by NetSuite workflow and approval settings.
- Approval Workflow: May require approval before items can be received, depending on NetSuite configuration.
- Receiving: Use NetSuite UI or Item Receipt API to receive items against the PO.
Error Handling
- Invalid Vendor ID: Returns error if vendor ID doesn’t exist in NetSuite.
- Invalid Item ID: Returns error if any item ID doesn’t exist or is inactive.
- Missing Required Fields: NetSuite may reject POs missing required custom fields.
- Retry Logic: Automatically retries failed requests up to 3 times.
- Location Parsing: Extracts PO ID from response headers - fails if ID cannot be parsed.
Workflow Integration
- Step 1: Sync vendors and items from NetSuite to get internal IDs.
- Step 2: Map your internal product/vendor data to NetSuite IDs.
- Step 3: Create purchase order with mapped IDs and line item details.
- Step 4: Store returned PO ID for tracking and receiving operations.
- Step 5: Monitor PO status through NetSuite sync or status checks.
Tips
[!TIP] Always sync vendors and items first to get accurate NetSuite internal IDs
[!TIP] Store the mapping between your internal IDs and NetSuite IDs for future use
[!IMPORTANT] The vendor and item IDs must be in the ‘netsuite-tba_id’ custom field
[!TIP] Specify either rate or amount per line - NetSuite calculates the other
[!TIP] Include quantity for each line item to avoid NetSuite default values
[!TIP] Use location IDs if you have multiple warehouses for proper inventory tracking
[!TIP] Test with a single line item first before creating complex multi-line POs
[!WARNING] Check NetSuite approval workflows - POs may require approval before receiving
[!TIP] Store the returned PO ID immediately for tracking and reference
[!TIP] Consider adding error handling for invalid vendor or item IDs
[!TIP] Use department and class fields for proper accounting allocation
[!TIP] For lot/serial tracked items, include inventory detail with serial/bin numbers
[!TIP] Validate that vendors and items are active in NetSuite before creating POs
[!TIP] The action uses minimal input - extend with additional fields as needed
[!WARNING] Monitor NetSuite rate limits when creating bulk purchase orders