# Workflow Action: Generate 810 ## Overview The **Generate 810** workflow action allows you to automatically generate Invoice (810) EDI transactions from Invoice records using NetSuite workflows. This provides a programmatic alternative to the manual "Generate 810" button. ## Use Cases Use this workflow action to: * Automatically generate 810 documents when invoices are approved or finalized * Trigger EDI invoice generation as part of a larger billing workflow * Eliminate manual steps in your invoicing process * Ensure EDI invoices are sent immediately upon invoice approval ## Supported Transaction Types This workflow action supports: * 810 (Invoice) * 880 (Grocery Products Invoice) * Simplified Invoice The workflow action applies to **Invoice** records. ## Prerequisites * The workflow action script must be deployed to your NetSuite account * Script ID: `customscript_orderful_generate_810_wa` * Deployment ID: `customdeploy_orderful_generate_810_wa` * The script must be in RELEASED status * Customer must have 810, 880, or Simplified Invoice enabled in their Orderful configuration ## 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 810 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 810 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 **Invoice** 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 810 WA" * **Deployment**: Select "Orderful | Generate 810 WA" 4. Optionally add conditions to control when the action executes ### 4. Set Workflow Conditions (Optional) To ensure the action only runs for appropriate invoices, add conditions such as: * **Status** = Paid In Full (or other approved status) * **Approval Status** = Approved * **Customer** has 810 enabled (check via custom field) * Any custom field criteria specific to your business logic ## Example Workflow Configuration ### Auto-Generate on Invoice Approval This example automatically generates 810 documents when an invoice is approved: **Workflow Settings:** * **Record Type:** Invoice * **Trigger:** After Record Submit * **Init On Create:** True **Workflow State:** * **Name:** Auto-Generate 810 on Approval * **Trigger Type:** On Entry **Workflow Action:** * **Type:** Execute Script * **Script:** Orderful | Generate 810 WA * **Conditions:** * Approval Status = Approved * Customer: 810 Enabled = True ### Conditional Generation Based on Field This example only generates 810 when a custom checkbox is enabled: **Workflow Action Conditions:** * Status ≠ Voided * Send EDI Invoice = True (custom field) ## What the Action Does When executed, the workflow action: 1. Loads the Invoice record 2. Sets the `Ready to Process (Invoice)` field to `true` 3. Sets the `Force Autosend` field to `true` 4. Saves the record This triggers the standard Orderful invoice processing logic, which: * Generates the 810/880/Simplified Invoice EDI message payload * Creates an Orderful Transaction record * Dispatches the transaction to Orderful via API (if autosend is enabled) This is the same functionality as clicking the "Generate 810" 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 ### 810 Not Being Generated * Verify the customer has 810/880/Simplified Invoice enabled in Orderful configuration * Check that ISA IDs are configured for the customer * Verify the invoice has required data (line items, customer info, etc.) * Review the Orderful Transaction record for error messages * Check the script execution log for detailed error information ### Duplicate 810 Documents * Add a condition to prevent re-triggering on already processed invoices * Check for existing Orderful Transaction records before executing * Use workflow state management to prevent multiple executions * Consider checking invoice status to avoid processing voided invoices ## Best Practices 1. **Add Status Checks:** Only trigger on finalized/approved invoices to avoid processing incomplete records 2. **Check Customer Configuration:** Verify customer has 810 enabled before generating 3. **Avoid Duplicate Processing:** Ensure workflow doesn't trigger multiple times for the same invoice 4. **Test in Sandbox:** Thoroughly test your workflow in a sandbox environment before deploying to production 5. **Monitor Execution:** Regularly review script execution logs during initial rollout 6. **Consider Timing:** Trigger after all invoice data is finalized (approval, line items, etc.) 7. **Handle Voids:** Exclude voided invoices from automatic processing ## Integration with Billing Process Consider these workflow triggers based on your billing process: * **After Invoice Created from Fulfillment:** Trigger immediately after invoice creation * **After Manual Approval:** Require approval before sending EDI * **After Payment Terms Set:** Ensure payment terms are finalized before generating * **Custom Billing Flag:** Use a custom field to control when invoices are ready for EDI ## Related Documentation * [Generate and Send Workflow Action](workflow-action-generate-and-send.md) * [Generate 856 Workflow Action](workflow-action-generate-856.md) * [Invoice Processing Documentation](../TransactionHandling/810/README.md) (if exists) * NetSuite Workflow Guide: Help Center > Workflow