Workflow Action: Generate 940

Overview

The Generate 940 workflow action allows you to automatically generate Warehouse Shipping Order (940) EDI transactions from Sales Order records using NetSuite workflows. This provides a programmatic alternative to the manual "Generate 940" button.

Use Cases

Use this workflow action to:

  • Automatically generate 940 documents when sales orders are ready for warehouse fulfillment
  • Trigger EDI warehouse shipping orders for drop-ship or 3PL scenarios
  • Eliminate manual steps in your warehouse order process
  • Ensure warehouse partners receive shipping instructions immediately
  • Communicate order details to third-party warehouses or fulfillment centers

Supported Transaction Types

This workflow action supports:

  • 940 (Warehouse Shipping Order)

The workflow action applies to Sales Order records where fulfillment will be handled by a warehouse/vendor.

Prerequisites

  • The workflow action script must be deployed to your NetSuite account
  • Script ID: customscript_orderful_generate_940_wa
  • Deployment ID: customdeploy_orderful_generate_940_wa
  • The script must be in RELEASED status
  • The Vendor associated with the sales order location must have 940 enabled in their Orderful configuration
  • Sales order must have a location with an associated vendor

Setup Instructions

1. Deploy the Script

The workflow action script should be automatically deployed when the Orderful bundle is installed. Verify deployment:

  1. Navigate to Customization > Scripting > Scripts
  2. Search for "Orderful | Generate 940 WA"
  3. Verify the script status is Released
  4. Check that the deployment is Deployed

2. Create or Edit a Workflow

To add the Generate 940 action to a workflow:

  1. Navigate to Customization > Workflow > Workflows
  2. Create a new workflow or edit an existing one
  3. Set the Record Type to Sales Order
  4. Add a workflow state where you want the action to execute

3. Add the Workflow Action

Within your workflow state:

  1. Click Add Action under the appropriate trigger type (e.g., After Field Edit, On Entry, etc.)
  2. Select Execute Script as the action type
  3. Configure the action:
    • Script: Select "Orderful | Generate 940 WA"
    • Deployment: Select "Orderful | Generate 940 WA"
  4. Optionally add conditions to control when the action executes

4. Set Workflow Conditions (Required)

To ensure the action only runs for appropriate sales orders, add conditions such as:

  • Status = Pending Fulfillment (or other appropriate status)
  • Location has a vendor assigned
  • Vendor has 940 enabled (check via location configuration)
  • Order Type = Drop Ship or Warehouse Fulfillment
  • Any custom field criteria specific to your business logic

Example Workflow Configuration

Auto-Generate for Drop-Ship Orders

This example automatically generates 940 documents for drop-ship orders:

Workflow Settings:

  • Record Type: Sales Order
  • Trigger: After Record Submit
  • Init On Create: True

Workflow State:

  • Name: Auto-Generate 940 for Drop Ship
  • Trigger Type: On Entry

Workflow Action:

  • Type: Execute Script
  • Script: Orderful | Generate 940 WA
  • Conditions:
    • Status = Pending Fulfillment
    • Shipping Method contains "Drop Ship"
    • Location is NOT empty

Conditional Generation Based on Field

This example only generates 940 when a custom checkbox is enabled:

Workflow Action Conditions:

  • Status ≠ Cancelled
  • Use 3PL Fulfillment = True (custom field)
  • Location has Vendor assigned

What the Action Does

When executed, the workflow action:

  1. Loads the Sales Order record
  2. Sets the Ready to Process (Warehouse Shipping Order) field to true
  3. Saves the record

This triggers the standard Orderful 940 processing logic, which:

  • Generates the 940 EDI message payload
  • Creates an Orderful Transaction record
  • Dispatches the transaction to Orderful via API (if autosend is enabled)

Note: Unlike other generate actions, this does NOT set the Force Autosend flag - the 940 follows its own autosend logic.

This is the same functionality as clicking the "Generate 940" button manually.

Error Handling

If the workflow action encounters an error:

  • The error is logged to the script execution log (Error level)
  • The workflow will halt or continue based on your workflow configuration
  • Check Customization > Scripting > Script Execution Log for detailed error information
  • Any errors during EDI generation will be captured on the resulting Orderful Transaction record

Troubleshooting

Action Not Executing

  • Verify the script deployment is Released and Deployed
  • Check workflow conditions are being met
  • Review the workflow execution log
  • Ensure the user role has permission to execute the script

940 Not Being Generated

  • Verify the sales order has a location assigned
  • Verify the location has a vendor assigned
  • Check that the vendor has 940 enabled in Orderful configuration
  • Check that ISA IDs are configured for the vendor
  • Verify the sales order has required data (line items, shipping info, etc.)
  • Review the Orderful Transaction record for error messages
  • Check the script execution log for detailed error information

Duplicate 940 Documents

  • Add a condition to prevent re-triggering on already processed sales orders
  • Check for existing Orderful Transaction records before executing
  • Use workflow state management to prevent multiple executions
  • Consider checking order status to avoid processing cancelled orders

Best Practices

  1. Validate Location/Vendor: Ensure location and vendor are set before triggering
  2. Add Status Checks: Only trigger on confirmed orders to avoid processing incomplete records
  3. Check Vendor Configuration: Verify vendor has 940 enabled before generating
  4. Avoid Duplicate Processing: Ensure workflow doesn't trigger multiple times for the same sales order
  5. Test in Sandbox: Thoroughly test your workflow in a sandbox environment before deploying to production
  6. Monitor Execution: Regularly review script execution logs during initial rollout
  7. Consider Timing: Trigger after inventory allocation and ship date confirmation
  8. Handle Cancellations: Exclude cancelled orders from automatic processing

Integration with Warehouse/3PL Process

Consider these workflow triggers based on your fulfillment process:

  • After Order Created: Trigger immediately after sales order creation for drop-ship
  • After Inventory Allocated: Wait until items are allocated before sending to warehouse
  • After Manual Review: Require approval before sending to 3PL
  • After Ship Date Confirmed: Ensure ship dates are set before sending
  • Custom Warehouse Flag: Use a custom field to control when orders are ready for warehouse

940 Use Cases

The 940 is typically used in these scenarios:

  • Drop-Ship: Vendor ships directly to customer
  • 3PL Fulfillment: Third-party logistics provider handles fulfillment
  • Warehouse Transfer: Shipping order to external warehouse
  • Cross-Dock: Items shipped through a warehouse without storage

Location and Vendor Configuration

For 940 to work properly:

  1. Location Setup: Sales order must have a location assigned
  2. Vendor Assignment: The location must have a vendor assigned in NetSuite
  3. Vendor as Entity: The vendor must be configured as an Orderful Entity
  4. 940 Enabled: The vendor entity must have 940 enabled with ISA IDs configured