# Fetch Sales Order Documents

> Perform Fetch Sales Order Documents through Brightree.

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

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

- Handler: `brightree_fetch_sales_order_documents`

- Connection type: `brightree`

## Inputs

- `sales_order_key` — Sales Order Key (expression, required)
  Required literal value or workflow expression.
- `document_types` — Document Types (multi_select, dynamic options)
  Optional list of selected values. Retrieve allowed values from the dynamic options endpoint.
- `document_types_expression` — Document Types Expression (expression)
  Optional literal value or workflow expression.
- `patient_id` — Patient Id (expression)
  Optional literal value or workflow expression.

## Outputs

- `success` — Success
- `document_ids` — Document Ids
- `documents` — Documents
- `missing_types` — Missing Types
- `errors` — Errors
- `error` — Error

Output schema completeness: `best_effort_declared`

## Safety

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

## Schemas

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

### Input schema

```json
{
  "type": "object",
  "required": [
    "sales_order_key"
  ],
  "properties": {
    "patient_id": {
      "description": "Optional literal value or workflow expression.",
      "x-workflow-field-type": "expression"
    },
    "document_types": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Optional list of selected values. Retrieve allowed values from the dynamic options endpoint.",
      "x-dynamic-options": true,
      "x-workflow-field-type": "multi_select"
    },
    "sales_order_key": {
      "description": "Required literal value or workflow expression.",
      "x-workflow-field-type": "expression"
    },
    "document_types_expression": {
      "description": "Optional literal value or workflow expression.",
      "x-workflow-field-type": "expression"
    }
  },
  "additionalProperties": false
}
```

### Output schema

```json
{
  "type": "object",
  "properties": {
    "error": {},
    "errors": {},
    "success": {},
    "documents": {},
    "document_ids": {},
    "missing_types": {}
  },
  "additionalProperties": true
}
```
