# Get Latest Sales Order

> Perform Get Latest Sales Order through Brightree.

Source: [https://genhealth.ai/docs/workflows/integrations/brightree/brightree_get_latest_sales_order](https://genhealth.ai/docs/workflows/integrations/brightree/brightree_get_latest_sales_order)

Integration: [Brightree](https://genhealth.ai/docs/workflows/integrations/brightree.md)

- Handler: `brightree_get_latest_sales_order`

- Connection type: `brightree`

## Inputs

- `patient_key` — Patient Key (expression)
  Optional literal value or workflow expression.
- `status` — Status (multi_select)
  Optional list of selected values.
  Options: New ("New"), Active ("Active"), On-Hold ("On-Hold"), Delivered ("Delivered"), Closed ("Closed"), Stopped ("Stopped")
- `created_date_from` — Created Date From (date)
  Optional date in YYYY-MM-DD format.
- `created_date_to` — Created Date To (date)
  Optional date in YYYY-MM-DD format.
- `read_detail` — Read Detail (boolean)
  Optional true-or-false value.
  Default: `true`

## Outputs

- `sales_order_key` — Sales Order Key
- `scheduled_date` — Scheduled Date
- `found` — Found
- `error` — Error

Output schema completeness: `best_effort_declared`

## Safety

- External effect: `read`
- Confirmation recommended: no
- Retry safe: yes
- Dry run supported: no

## Schemas

These schemas are first-pass authoring guidance. Runtime validation remains authoritative.

### Input schema

```json
{
  "type": "object",
  "properties": {
    "status": {
      "type": "array",
      "items": {
        "enum": [
          "New",
          "Active",
          "On-Hold",
          "Delivered",
          "Closed",
          "Stopped"
        ],
        "type": "string"
      },
      "description": "Optional list of selected values.",
      "x-workflow-field-type": "multi_select"
    },
    "patient_key": {
      "description": "Optional literal value or workflow expression.",
      "x-workflow-field-type": "expression"
    },
    "read_detail": {
      "type": "boolean",
      "default": true,
      "description": "Optional true-or-false value.",
      "x-workflow-field-type": "boolean"
    },
    "created_date_to": {
      "type": "string",
      "format": "date",
      "description": "Optional date in YYYY-MM-DD format.",
      "x-workflow-field-type": "date"
    },
    "created_date_from": {
      "type": "string",
      "format": "date",
      "description": "Optional date in YYYY-MM-DD format.",
      "x-workflow-field-type": "date"
    }
  },
  "additionalProperties": false
}
```

### Output schema

```json
{
  "type": "object",
  "properties": {
    "error": {},
    "found": {},
    "scheduled_date": {},
    "sales_order_key": {}
  },
  "additionalProperties": true
}
```
