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.

  1. On the DigitalGenius dashboard, go to Modules → Orderwise and add a connection:
FieldWhat to enter
UsernameYour Orderwise API username.
PasswordYour Orderwise API password.
base_urlThe base URL of your Orderwise API, for example https://example.orderwisecloud.com/OWAPI. It must start with https://.
  1. 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

NameTypeRequiredDescription
Orderwise IDStringYesOrderwise order ID (the order header ID). Must be a whole number. A value such as 1001.0 is read as 1001.
Customer IDStringYesOrderwise customer ID that owns the order. Can contain only letters, digits, - and _.
Safe ModeOptional BooleanNoDefault false. See Safe Mode below.

Outputs

NameTypeDescription
SuccessBooleantrue when the order was found and matches the Orderwise ID.
Line ItemsListThe order's lines as returned by Orderwise. Empty when the action fails.
Error MessageStringWhat 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 example RuntimeError: Orderwise request failed with status 404: ....

Common errors

ErrorWhat it means
Missing Orderwise connectionNo Orderwise connection is selected on the action.
Orderwise connection base_url must be an https URLThe 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 tokenOrderwise 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 customerNo order with this ID was found for the customer in the searched date range.
Orderwise ID must be a whole numberThe Orderwise ID input isn't a whole number.
Customer ID is requiredThe Customer ID input is empty.

Example

InputValue
Orderwise ID1001
Customer ID55
Safe Modetrue

Output:

{
  "success": true,
  "line_items": [
    { "id": 1, "itemNumber": "98765" },
    { "id": 2, "itemNumber": "11111" }
  ],
  "error_message": ""
}

Did this page help you?