Workflow Action: Reprocess

Overview

The Reprocess workflow action allows you to automatically retry processing of failed inbound EDI transactions from Orderful Transaction records using NetSuite workflows. This provides a programmatic alternative to the manual "Reprocess" button.

Use Cases

Use this workflow action to:

  • Automatically retry failed inbound transactions after a certain period
  • Re-process transactions when blocking conditions are resolved
  • Eliminate manual steps in error recovery workflows
  • Implement automatic retry logic based on error types or counts

Supported Transaction Types

This workflow action supports inbound Orderful Transaction records with any document type that has:

  • Status ≠ Success
  • Pending Transaction Count = 0 (not currently being processed)
  • Direction = Inbound

Prerequisites

  • The workflow action script must be deployed to your NetSuite account
  • Script ID: customscript_orderful_reprocess_wa
  • Deployment ID: customdeploy_orderful_reprocess_wa
  • The script must be in RELEASED status
  • The Map/Reduce script (customscript_orderful_transaction_mr) must be deployed and available

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 | Reprocess WA"
  3. Verify the script status is Released
  4. Check that the deployment is Deployed

2. Create or Edit a Workflow

To add the Reprocess 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 Orderful Transaction
  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., Scheduled, After Field Edit, etc.)
  2. Select Execute Script as the action type
  3. Configure the action:
    • Script: Select "Orderful | Reprocess WA"
    • Deployment: Select "Orderful | Reprocess WA"
  4. Optionally add conditions to control when the action executes

4. Set Workflow Conditions (Required)

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

  • Direction = Inbound
  • Status ≠ Success
  • Pending Transaction Count = 0
  • Error Message contains specific error text (optional)
  • Last Modified Date is more than X hours/days ago (for retry delays)
  • Any custom field criteria specific to your business logic

Example Workflow Configuration

Auto-Retry Failed Transactions After 1 Hour

This example automatically retries failed transactions after they've been in error state for 1 hour:

Workflow Settings:

  • Record Type: Orderful Transaction
  • Trigger: Scheduled (Hourly)
  • Init On Create: False

Workflow State:

  • Name: Auto-Retry Failed Transactions
  • Trigger Type: On Entry

Workflow Action:

  • Type: Execute Script
  • Script: Orderful | Reprocess WA
  • Conditions:
    • Direction = Inbound
    • Status = Error
    • Pending Transaction Count = 0
    • Last Modified is more than 1 hour ago

Retry on Field Flag Change

This example retries processing when a custom "Retry" checkbox is checked:

Workflow Settings:

  • Record Type: Orderful Transaction
  • Trigger: After Field Edit

Workflow Action Conditions:

  • Direction = Inbound
  • Status ≠ Success
  • Pending Transaction Count = 0
  • Custom "Retry Now" Field = True

What the Action Does

When executed, the workflow action:

  1. Loads the Orderful Transaction record
  2. Validates the transaction exists
  3. Submits a Map/Reduce task to reprocess the transaction
  4. Logs the submission to the script execution log

This is the same functionality as clicking the "Reprocess" button manually. The actual reprocessing happens asynchronously via the Map/Reduce script.

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
  • If the Map/Reduce script submission fails, the transaction will remain in its current state

Troubleshooting

Action Not Executing

  • Verify the script deployment is Released and Deployed
  • Check workflow conditions are being met (especially Pending Transaction Count = 0)
  • Review the workflow execution log
  • Ensure the user role has permission to execute the script

Transaction Not Being Reprocessed

  • Verify the Map/Reduce script is deployed and available
  • Check the Orderful Transaction record's Pending Transaction Count
  • Review the script execution log for detailed error information
  • Ensure governance limits haven't been exceeded

Infinite Retry Loop

  • Add conditions to limit retry attempts (e.g., using a counter field)
  • Use time-based conditions to prevent immediate retries
  • Exclude specific error types that won't be resolved by reprocessing
  • Consider adding a maximum retry count field

Best Practices

  1. Add Retry Limits: Implement a counter to prevent infinite retry loops
  2. Use Time Delays: Don't retry immediately - wait for conditions to potentially resolve
  3. Check Pending Count: Always verify Pending Transaction Count = 0 before retrying
  4. Filter by Error Type: Only retry errors that might be resolved (e.g., temporary connection issues)
  5. Monitor Execution: Regularly review script execution logs during initial rollout
  6. Test in Sandbox: Thoroughly test your workflow in a sandbox environment before deploying to production

Advanced Configuration

Retry Counter Example

To prevent infinite retries, add a custom field to track retry attempts:

  1. Create a custom integer field: custrecord_retry_count
  2. Add workflow logic to increment this field on each retry
  3. Add a condition to only retry if custrecord_retry_count < 3
  4. Reset the counter when status changes to Success

Error-Type Specific Retry

Create different workflow states for different error types:

  • Temporary Errors: Retry automatically after short delay
  • Configuration Errors: Don't retry until admin intervention
  • Data Errors: Retry after field is updated

Related Documentation

Support

For issues or questions:

  • Review the script execution log for detailed error information
  • Contact Head in the Cloud Development, Inc. at [email protected]
  • Check the Orderful support documentation