Writing to Orderful Packaging Records


WMS Integration: EDI Carton and Packed Item Custom Records

This document provides complete technical specifications for the EDI Carton and Shipped Item (Packed Item) custom records. WMS integration developers can use this reference to write packing and carton data directly to NetSuite.

Overview

The Orderful NetSuite Connector uses two custom records to store package-level shipping data:

RecordScript IDPurpose
EDI Cartoncustomrecord_orderful_cartonRepresents a physical package (carton or pallet) being shipped
Shipped Itemcustomrecord_orderful_shipped_itemRepresents individual items packed within a carton

These records are used to generate EDI 856 (Advanced Shipment Notice) documents and support GS1 compliance with SSCC-18 barcodes.


Record Relationships

Item Fulfillment (NetSuite Standard Record)
    │
    ├── EDI Carton (1:many)
    │       │
    │       ├── Shipped Items (1:many) - Items packed in this carton
    │       │
    │       └── Child Cartons (optional) - For pallet/carton hierarchy
    │               │
    │               └── Shipped Items (1:many)

Key Relationships:

  • Each EDI Carton must be linked to an Item Fulfillment record
  • Shipped Items are child records of EDI Cartons
  • Cartons can have a parent carton (for pallet hierarchies)
  • The fulfillment field on Shipped Item must match the fulfillment field on its parent Carton

EDI Carton Record

Record Type ID: customrecord_orderful_carton Label: EDI Carton

Field Reference

Field LabelField IDTypeRequiredMax LengthDescription
Item Fulfillmentcustrecord_orderful_carton_fulfillmentSELECTYes-Reference to the parent Item Fulfillment record. This is the primary relationship field.
Is Pallet/Tarecustrecord_orderful_carton_is_palletCHECKBOXYes-Indicates if this record represents a pallet or tare package. Pallet packages can be used as parents of other packages. Default: F
Lengthcustrecord_orderful_carton_lengthFLOATNo-Package length in inches
Widthcustrecord_orderful_carton_widthFLOATNo-Package width in inches
Heightcustrecord_orderful_carton_heightFLOATNo-Package height in inches
Weightcustrecord_orderful_carton_weightFLOATNo-Package weight in pounds (lbs)
Custom Serialcustrecord_orderful_carton_custom_serialTEXTNo20Custom serial number. Use this if you want to override the auto-generated record number.
Parent Cartoncustrecord_orderful_carton_palletSELECTNo-Reference to another EDI Carton record (self-referential). Used to create pallet/carton hierarchies.
Tracking Numbercustrecord_orderful_carton_trackingTEXTNo-Carrier tracking number for this package
Transit Dayscustrecord_orderful_carton_transit_daysINTEGERNo-Estimated transit days for delivery
Pallet Tierscustrecord_orderful_carton_tiersINTEGERNo-Number of tiers (layers) on the pallet. Only applicable when Is Pallet/Tare is checked.
Pallet Blockscustrecord_orderful_carton_blocksINTEGERNo-Number of blocks on the pallet. Only applicable when Is Pallet/Tare is checked.
SSCC18custrecord_orderful_carton_sscc18TEXTNo-Serial Shipping Container Code (18-digit GS1 standard barcode). Note: This field has LOCKED display type - it is displayed but typically set programmatically.

Standard Fields

FieldDescription
IDNetSuite internal ID (auto-generated)
NameAuto-generated serial number with 6-digit minimum (e.g., 000001). Can be overridden via the altname field.

Record Configuration Notes

  • Numbering: Enabled with 6-digit minimum padding
  • Inline Editing: Allowed
  • Optimistic Locking: Enabled
  • Parent Subtab: Cartons appear on Item Fulfillment records under the custom subtab custtab_orderful_transaction

Shipped Item Record (Packed Items)

Record Type ID: customrecord_orderful_shipped_item Label: Shipped Item

Field Reference

Field LabelField IDTypeRequiredDescription
Itemcustrecord_orderful_shipped_itemSELECTNoReference to a NetSuite Item record (internal ID -10). The item being packed.
Cartoncustrecord_orderful_shipped_cartonSELECTNoReference to the parent EDI Carton record. Important: This field is filtered to only show cartons that match the Shipped Item's fulfillment.
Quantitycustrecord_orderful_shipped_quantityFLOATNoQuantity of the item packed in this carton
Fulfillmentcustrecord_orderful_shipped_fulfillmentSELECTNoReference to the Item Fulfillment record. Must match the fulfillment on the parent Carton for proper filtering.
Lot Serial Numbercustrecord_orderful_lot_serial_numberTEXTNoLot number or serial number for this packed item. Used for lot/serial tracking in EDI documents.
Expiry Datecustrecord_orderful_item_expiry_dateDATENoExpiration/best-by date of the shipped item

Record Configuration Notes

  • Numbering: Disabled (no auto-generated numbers)
  • Inline Editing: Allowed
  • Attachments: Allowed
  • Parent Subtab: Shipped Items appear on EDI Carton records under the orderful_carton_items subtab

Writing to These Records

Method 1: Using NetSuite Record API (SuiteScript 2.x)

Creating an EDI Carton with Packed Items

/**
 * @NApiVersion 2.1
 */
define(['N/record'], function(record) {

    function createCartonWithItems(fulfillmentId, cartonData, items) {
        // Create the carton record
        var cartonRecord = record.create({
            type: 'customrecord_orderful_carton'
        });

        // Set required fields
        cartonRecord.setValue({
            fieldId: 'custrecord_orderful_carton_fulfillment',
            value: fulfillmentId
        });

        cartonRecord.setValue({
            fieldId: 'custrecord_orderful_carton_is_pallet',
            value: cartonData.isPallet || false
        });

        // Set optional dimension fields
        if (cartonData.length) {
            cartonRecord.setValue({
                fieldId: 'custrecord_orderful_carton_length',
                value: cartonData.length
            });
        }

        if (cartonData.width) {
            cartonRecord.setValue({
                fieldId: 'custrecord_orderful_carton_width',
                value: cartonData.width
            });
        }

        if (cartonData.height) {
            cartonRecord.setValue({
                fieldId: 'custrecord_orderful_carton_height',
                value: cartonData.height
            });
        }

        if (cartonData.weight) {
            cartonRecord.setValue({
                fieldId: 'custrecord_orderful_carton_weight',
                value: cartonData.weight
            });
        }

        // Set tracking number if provided
        if (cartonData.trackingNumber) {
            cartonRecord.setValue({
                fieldId: 'custrecord_orderful_carton_tracking',
                value: cartonData.trackingNumber
            });
        }

        // Set custom serial if provided
        if (cartonData.customSerial) {
            cartonRecord.setValue({
                fieldId: 'custrecord_orderful_carton_custom_serial',
                value: cartonData.customSerial
            });
        }

        // Set SSCC if provided
        if (cartonData.sscc) {
            cartonRecord.setValue({
                fieldId: 'custrecord_orderful_carton_sscc18',
                value: cartonData.sscc
            });
        }

        // Set parent carton for pallet hierarchy
        if (cartonData.parentCartonId) {
            cartonRecord.setValue({
                fieldId: 'custrecord_orderful_carton_pallet',
                value: cartonData.parentCartonId
            });
        }

        // Add packed items via sublist
        var sublistId = 'recmachcustrecord_orderful_shipped_carton';

        items.forEach(function(item, index) {
            cartonRecord.setSublistValue({
                sublistId: sublistId,
                fieldId: 'custrecord_orderful_shipped_fulfillment',
                line: index,
                value: fulfillmentId
            });

            cartonRecord.setSublistValue({
                sublistId: sublistId,
                fieldId: 'custrecord_orderful_shipped_item',
                line: index,
                value: item.itemId
            });

            cartonRecord.setSublistValue({
                sublistId: sublistId,
                fieldId: 'custrecord_orderful_shipped_quantity',
                line: index,
                value: item.quantity
            });

            // Optional: lot/serial number
            if (item.lotSerialNumber) {
                cartonRecord.setSublistValue({
                    sublistId: sublistId,
                    fieldId: 'custrecord_orderful_lot_serial_number',
                    line: index,
                    value: item.lotSerialNumber
                });
            }

            // Optional: expiry date
            if (item.expiryDate) {
                cartonRecord.setSublistValue({
                    sublistId: sublistId,
                    fieldId: 'custrecord_orderful_item_expiry_date',
                    line: index,
                    value: item.expiryDate
                });
            }
        });

        // Save and return the carton ID
        return cartonRecord.save({
            ignoreMandatoryFields: true
        });
    }

    return {
        createCartonWithItems: createCartonWithItems
    };
});

Creating Records Separately

/**
 * Create carton and items as separate operations
 */
define(['N/record'], function(record) {

    function createCarton(fulfillmentId, cartonData) {
        var cartonRecord = record.create({
            type: 'customrecord_orderful_carton'
        });

        cartonRecord.setValue({
            fieldId: 'custrecord_orderful_carton_fulfillment',
            value: fulfillmentId
        });

        cartonRecord.setValue({
            fieldId: 'custrecord_orderful_carton_is_pallet',
            value: cartonData.isPallet || false
        });

        // Set other fields as needed...

        return cartonRecord.save();
    }

    function createShippedItem(fulfillmentId, cartonId, itemData) {
        var shippedItemRecord = record.create({
            type: 'customrecord_orderful_shipped_item'
        });

        shippedItemRecord.setValue({
            fieldId: 'custrecord_orderful_shipped_fulfillment',
            value: fulfillmentId
        });

        shippedItemRecord.setValue({
            fieldId: 'custrecord_orderful_shipped_carton',
            value: cartonId
        });

        shippedItemRecord.setValue({
            fieldId: 'custrecord_orderful_shipped_item',
            value: itemData.itemId
        });

        shippedItemRecord.setValue({
            fieldId: 'custrecord_orderful_shipped_quantity',
            value: itemData.quantity
        });

        if (itemData.lotSerialNumber) {
            shippedItemRecord.setValue({
                fieldId: 'custrecord_orderful_lot_serial_number',
                value: itemData.lotSerialNumber
            });
        }

        if (itemData.expiryDate) {
            shippedItemRecord.setValue({
                fieldId: 'custrecord_orderful_item_expiry_date',
                value: itemData.expiryDate
            });
        }

        return shippedItemRecord.save();
    }

    return {
        createCarton: createCarton,
        createShippedItem: createShippedItem
    };
});

Method 2: Using SuiteQL

Querying Existing Cartons and Items

-- Query all cartons for a specific fulfillment
SELECT
    c.id AS carton_id,
    c.name AS carton_name,
    c.custrecord_orderful_carton_fulfillment AS fulfillment_id,
    c.custrecord_orderful_carton_length AS length,
    c.custrecord_orderful_carton_width AS width,
    c.custrecord_orderful_carton_height AS height,
    c.custrecord_orderful_carton_weight AS weight,
    c.custrecord_orderful_carton_is_pallet AS is_pallet,
    c.custrecord_orderful_carton_tracking AS tracking_number,
    c.custrecord_orderful_carton_sscc18 AS sscc18,
    c.custrecord_orderful_carton_pallet AS parent_carton_id
FROM
    customrecord_orderful_carton c
WHERE
    c.custrecord_orderful_carton_fulfillment = ?
-- Query packed items with carton details
SELECT
    si.id AS shipped_item_id,
    si.custrecord_orderful_shipped_item AS item_id,
    si.custrecord_orderful_shipped_quantity AS quantity,
    si.custrecord_orderful_shipped_carton AS carton_id,
    si.custrecord_orderful_lot_serial_number AS lot_serial,
    si.custrecord_orderful_item_expiry_date AS expiry_date,
    c.name AS carton_name,
    c.custrecord_orderful_carton_sscc18 AS carton_sscc
FROM
    customrecord_orderful_shipped_item si
    LEFT JOIN customrecord_orderful_carton c
        ON si.custrecord_orderful_shipped_carton = c.id
WHERE
    si.custrecord_orderful_shipped_fulfillment = ?

Method 3: Using REST Web Services

If using NetSuite's REST API, use the following endpoint patterns:

Create Carton:

POST /services/rest/record/v1/customrecord_orderful_carton

Create Shipped Item:

POST /services/rest/record/v1/customrecord_orderful_shipped_item

Example: Complete Pallet with Cartons

This example shows how to create a pallet containing multiple cartons, each with packed items:

/**
 * Creates a complete pallet hierarchy:
 * - 1 Pallet (parent carton with isPallet=true)
 * - 2 Cartons on the pallet
 * - Items in each carton
 */
define(['N/record'], function(record) {

    function createPalletWithCartons(fulfillmentId) {
        // Step 1: Create the pallet (parent carton)
        var palletRecord = record.create({
            type: 'customrecord_orderful_carton'
        });

        palletRecord.setValue({
            fieldId: 'custrecord_orderful_carton_fulfillment',
            value: fulfillmentId
        });

        palletRecord.setValue({
            fieldId: 'custrecord_orderful_carton_is_pallet',
            value: true  // This is a pallet
        });

        palletRecord.setValue({
            fieldId: 'custrecord_orderful_carton_length',
            value: 48  // Standard pallet length
        });

        palletRecord.setValue({
            fieldId: 'custrecord_orderful_carton_width',
            value: 40  // Standard pallet width
        });

        palletRecord.setValue({
            fieldId: 'custrecord_orderful_carton_height',
            value: 60
        });

        palletRecord.setValue({
            fieldId: 'custrecord_orderful_carton_weight',
            value: 500
        });

        palletRecord.setValue({
            fieldId: 'custrecord_orderful_carton_tiers',
            value: 5  // 5 tiers on this pallet
        });

        palletRecord.setValue({
            fieldId: 'custrecord_orderful_carton_blocks',
            value: 4  // 4 blocks per tier
        });

        var palletId = palletRecord.save();

        // Step 2: Create first carton on the pallet
        var carton1Id = createCartonOnPallet(fulfillmentId, palletId, {
            length: 12,
            width: 12,
            height: 12,
            weight: 25,
            trackingNumber: '1Z999AA10123456784'
        }, [
            { itemId: 123, quantity: 10, lotSerialNumber: 'LOT-001' },
            { itemId: 456, quantity: 5, lotSerialNumber: 'LOT-002' }
        ]);

        // Step 3: Create second carton on the pallet
        var carton2Id = createCartonOnPallet(fulfillmentId, palletId, {
            length: 12,
            width: 12,
            height: 12,
            weight: 30,
            trackingNumber: '1Z999AA10123456785'
        }, [
            { itemId: 789, quantity: 20 }
        ]);

        return {
            palletId: palletId,
            cartonIds: [carton1Id, carton2Id]
        };
    }

    function createCartonOnPallet(fulfillmentId, palletId, cartonData, items) {
        var cartonRecord = record.create({
            type: 'customrecord_orderful_carton'
        });

        cartonRecord.setValue({
            fieldId: 'custrecord_orderful_carton_fulfillment',
            value: fulfillmentId
        });

        cartonRecord.setValue({
            fieldId: 'custrecord_orderful_carton_is_pallet',
            value: false  // This is a carton, not a pallet
        });

        cartonRecord.setValue({
            fieldId: 'custrecord_orderful_carton_pallet',
            value: palletId  // Link to parent pallet
        });

        // Set dimensions
        if (cartonData.length) {
            cartonRecord.setValue({
                fieldId: 'custrecord_orderful_carton_length',
                value: cartonData.length
            });
        }
        if (cartonData.width) {
            cartonRecord.setValue({
                fieldId: 'custrecord_orderful_carton_width',
                value: cartonData.width
            });
        }
        if (cartonData.height) {
            cartonRecord.setValue({
                fieldId: 'custrecord_orderful_carton_height',
                value: cartonData.height
            });
        }
        if (cartonData.weight) {
            cartonRecord.setValue({
                fieldId: 'custrecord_orderful_carton_weight',
                value: cartonData.weight
            });
        }
        if (cartonData.trackingNumber) {
            cartonRecord.setValue({
                fieldId: 'custrecord_orderful_carton_tracking',
                value: cartonData.trackingNumber
            });
        }

        // Add items via sublist
        var sublistId = 'recmachcustrecord_orderful_shipped_carton';
        items.forEach(function(item, index) {
            cartonRecord.setSublistValue({
                sublistId: sublistId,
                fieldId: 'custrecord_orderful_shipped_fulfillment',
                line: index,
                value: fulfillmentId
            });
            cartonRecord.setSublistValue({
                sublistId: sublistId,
                fieldId: 'custrecord_orderful_shipped_item',
                line: index,
                value: item.itemId
            });
            cartonRecord.setSublistValue({
                sublistId: sublistId,
                fieldId: 'custrecord_orderful_shipped_quantity',
                line: index,
                value: item.quantity
            });
            if (item.lotSerialNumber) {
                cartonRecord.setSublistValue({
                    sublistId: sublistId,
                    fieldId: 'custrecord_orderful_lot_serial_number',
                    line: index,
                    value: item.lotSerialNumber
                });
            }
        });

        return cartonRecord.save({ ignoreMandatoryFields: true });
    }

    return {
        createPalletWithCartons: createPalletWithCartons
    };
});

Data Validation Requirements

When writing to these records, ensure:

  1. Fulfillment Consistency: The fulfillment field on Shipped Items must match the fulfillment field on the parent Carton

  2. Item References: Item internal IDs must reference valid NetSuite Item records

  3. Pallet Hierarchy:

    • Only cartons with custrecord_orderful_carton_is_pallet = true should be used as parent cartons
    • A carton cannot be its own parent
  4. SSCC-18 Format: If providing SSCC values, use the standard 18-digit GS1 format

  5. Dimension Units:

    • Length, Width, Height: inches
    • Weight: pounds (lbs)

Field ID Quick Reference

EDI Carton Fields

PurposeField ID
Fulfillment (Required)custrecord_orderful_carton_fulfillment
Is Pallet (Required)custrecord_orderful_carton_is_pallet
Lengthcustrecord_orderful_carton_length
Widthcustrecord_orderful_carton_width
Heightcustrecord_orderful_carton_height
Weightcustrecord_orderful_carton_weight
Custom Serialcustrecord_orderful_carton_custom_serial
Parent Cartoncustrecord_orderful_carton_pallet
Tracking Numbercustrecord_orderful_carton_tracking
Transit Dayscustrecord_orderful_carton_transit_days
Pallet Tierscustrecord_orderful_carton_tiers
Pallet Blockscustrecord_orderful_carton_blocks
SSCC18custrecord_orderful_carton_sscc18

Shipped Item Fields

PurposeField ID
Itemcustrecord_orderful_shipped_item
Cartoncustrecord_orderful_shipped_carton
Quantitycustrecord_orderful_shipped_quantity
Fulfillmentcustrecord_orderful_shipped_fulfillment
Lot/Serial Numbercustrecord_orderful_lot_serial_number
Expiry Datecustrecord_orderful_item_expiry_date

Sublist ID for Inline Item Creation

When creating items inline with a carton:

recmachcustrecord_orderful_shipped_carton

Support

For questions about integrating with these custom records, contact your Orderful implementation team.