Orderwise Get Line Item IDs
Returns the line items of an Orderwise sales order and checks that the order Orderwise returns is the one requested. Uses the Orderwise module connection.
Orderwise Get Line Item IDs
Returns the line items of an Orderwise sales order, and checks that the order Orderwise returns is the one requested.
Use it to find the lines of a customer's order, for example before changing or cancelling items in Orderwise.
Before you start
This action uses an Orderwise module connection for its credentials, so you never put a username, password or token in your flow.
- On the DigitalGenius dashboard, go to Modules → Orderwise and add a connection:
| Field | What to enter |
|---|---|
| Username | Your Orderwise API username. |
| Password | Your Orderwise API password. |
| base_url | The base URL of your Orderwise API, for example https://example.orderwisecloud.com/OWAPI. It must start with https://. |
- In Flow Builder, add the Orderwise Get Line Item IDs action and select this connection on it.
At the start of every run, the action exchanges the connection's login for a bearer token (GET {base_url}/token/gettoken). It then calls the Orderwise API with that token. The action doesn't store the token between runs.
How the order is found
The action requests the first order after Orderwise ID - 1 for the customer (GET /sales/orders with last_id and limit=1). The search covers orders dated from 1 January 2020 to one year after the current date.
If Orderwise returns no order, or an order with a different ID, the action fails. It never returns the lines of a different order.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| Orderwise ID | String | Yes | Orderwise order ID (the order header ID). Must be a whole number. A value such as 1001.0 is read as 1001. |
| Customer ID | String | Yes | Orderwise customer ID that owns the order. Can contain only letters, digits, - and _. |
| Safe Mode | Optional Boolean | No | Default false. See Safe Mode below. |
Outputs
| Name | Type | Description |
|---|---|---|
| Success | Boolean | true when the order was found and matches the Orderwise ID. |
| Line Items | List | The order's lines as returned by Orderwise. Empty when the action fails. |
| Error Message | String | What went wrong. Only returned when Safe Mode is on and the action fails. |
Safe Mode
- Off (default): if the action fails, the flow stops.
- On: the action returns
Success = false, an empty Line Items list and an Error Message, and the flow continues. The error message starts with the error type, for exampleRuntimeError: Orderwise request failed with status 404: ....
Common errors
| Error | What it means |
|---|---|
Missing Orderwise connection | No Orderwise connection is selected on the action. |
Orderwise connection base_url must be an https URL | The connection's base_url field is empty, doesn't start with https://, or contains a username or password. |
Orderwise token request failed with status ... | Orderwise rejected the login. Check the username and password on the connection. |
Orderwise token response did not contain a token | Orderwise answered the token request, but the reply wasn't a token. Check that base_url points to the Orderwise API. |
Orderwise request failed with status ...: ... | The Orderwise API returned an error. The message includes Orderwise's own error text, up to 200 characters. |
Orderwise request failed: ... | The request didn't reach Orderwise, for example a connection error or a timeout. Only the error type is shown. |
Orderwise did not return order ... for this customer | No order with this ID was found for the customer in the searched date range. |
Orderwise ID must be a whole number | The Orderwise ID input isn't a whole number. |
Customer ID is required | The Customer ID input is empty. |
Example
| Input | Value |
|---|---|
| Orderwise ID | 1001 |
| Customer ID | 55 |
| Safe Mode | true |
Output:
{
"success": true,
"line_items": [
{ "id": 1, "itemNumber": "98765" },
{ "id": 2, "itemNumber": "11111" }
],
"error_message": ""
}Updated 1 day ago
