Actions22
Overview
The node interacts with the Distru API to upsert (create or update) sales orders. It allows users to submit detailed order information including company, billing and shipping locations, order dates, payment types, status, notes, items, and charges. If an order ID is provided and exists, the node updates that order; otherwise, it creates a new order record.
This node is beneficial in scenarios where businesses need to automate order management workflows, synchronize order data between systems, or integrate order processing into larger automation pipelines. For example, an e-commerce platform could use this node to automatically create or update sales orders in Distru when a customer places or modifies an order.
Properties
| Name | Meaning |
|---|---|
| ID | Unique identifier for the sales order. If it exists, the order will be updated; if not, a new order will be created with this ID. |
| Company ID | Identifier of the company associated with the order. This is required. |
| Billing Location ID | Identifier for the billing location related to the order. |
| Shipping Location ID | Identifier for the shipping location related to the order. |
| Order Datetime | Date and time when the order was placed. |
| Due Datetime | Date and time by which the order is due. |
| Delivery Datetime | Date and time when the order is scheduled for delivery. |
| Blaze Payment Type | A string representing the payment type used in Blaze (payment system). |
| Status | Current status of the order. Possible values: CANCELED, COMPLETED, DELIVERED, DELIVERING, PENDING, PROCESSING, READY_TO_SHIP. Default is PENDING. |
| Internal Notes | Internal notes about the order, visible only within the organization. |
| External Notes | External notes about the order, possibly visible to customers or external parties. |
| Order Items | Collection of order items. Each item includes: - Product ID (required for product-tracked items) - Quantity (string with 9 decimal places) - Base Price (string with 9 decimal places) - Location ID (required) - Batch ID (for batch-tracked items) - Package ID (for package-tracked items) - Compliance Quantity (string with 4 decimal places) |
| Charges | Collection of charges or discounts applied to the order. Each charge includes: - Name - Type ( CHARGE, DISCOUNT, TAX)- Unit Type ( PERCENT, PRICE)- Percent (if unit type is percent, string with 4 decimal places) - Price (if unit type is price, string with 2 decimal places) - ID (for updating existing charges) |
| Order Items (JSON) | JSON string to set the entire array of order items directly. Overrides the form-based order items if set. |
| Charges (JSON) | JSON string to set the entire array of charges directly. Overrides the form-based charges if set. |
Output
The node outputs an array of JSON objects representing the created or updated sales order(s) as returned by the Distru API. The output JSON contains all details of the order including IDs, timestamps, status, items, charges, and any other relevant metadata from the API response.
No binary data is output by this node.
Dependencies
- Requires an API token credential for authenticating with the Distru API.
- The node uses the Distru public API endpoint, either production or staging based on configuration.
- No additional external dependencies are required beyond the API token.
Troubleshooting
- Missing API Token: The node will throw an error if the API token credential is not set. Ensure you have configured the API token correctly in n8n credentials.
- Invalid IDs: IDs such as order ID, product ID, location ID, batch ID, etc., must be valid UUIDs or convertible to UUID format. Invalid IDs may cause API errors.
- Required Fields Missing: Company ID is mandatory. Also, each order item requires a location ID and product ID for product-tracked items. Missing these can cause failures.
- JSON Overrides: If you provide JSON strings for items or charges, they override the form inputs. Malformed JSON will cause errors.
- API Errors: Any API error messages from Distru will be propagated. Check the error message for details and verify your input data and API permissions.
- Continue On Fail: If enabled, the node will continue processing subsequent items even if one fails, returning error details in the output.
Links and References
- Distru API Documentation (general reference for API endpoints and data structures)
- n8n Documentation on Creating Custom Nodes