# Ensure Sales Order Items

> Perform Ensure Sales Order Items through Brightree.

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

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

- Handler: `brightree_ensure_sales_order_items`

- Connection type: `brightree`

## Use in a workflow

Copy this discovered node config, fill params from the input contract, and validate the complete graph. Integration results are available as {{node_id.default.field}}. Check business success before dependent writes; completion alone does not prove business success.

```json

{
  "_group": "Brightree",
  "params": {
    "dry_run": true
  },
  "handler": "brightree_ensure_sales_order_items"
}

```

[Action contracts](https://genhealth.ai/docs/workflows/action-contracts.md) · [Run recovery](https://genhealth.ai/docs/workflows/operations.md)

## Inputs

- `document_id` — Document Id (expression, required)
  Required literal value or workflow expression.
- `patient_key` — Patient Key (expression, required)
  Required literal value or workflow expression.
- `sales_order_key` — Sales Order Key (expression, required)
  Required literal value or workflow expression.
- `items` — Items (repeatable_group, required)
  Required list of structured items.
  - `item_code` — Item Code (text, required)
    Required text value.
  - `procedure_code` — Procedure Code (text, required)
    Required text value.
  - `quantity` — Quantity (number, required)
    Required numeric value.
  - `sale_type` — Sale Type (select, required)
    Required selected identifier or value.
    Options: Purchase ("purchase"), Rental ("rental")
- `dry_run` — Dry Run (boolean)
  Optional true-or-false value.
  Default: `true`

## Outputs

- `success` — Success
- `document_id` — Document Id
- `verified` — Verified
- `dry_run` — Dry Run
- `changed` — Changed
- `added_items` — Added Items
- `missing_items` — Missing Items
- `error` — Error

Output schema completeness: `best_effort_declared`

## Safety

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

## Schemas

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

### Input schema

```json
{
  "type": "object",
  "required": [
    "document_id",
    "patient_key",
    "sales_order_key",
    "items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "item_code",
          "procedure_code",
          "quantity",
          "sale_type"
        ],
        "properties": {
          "quantity": {
            "type": "number",
            "description": "Required numeric value.",
            "x-workflow-field-type": "number"
          },
          "item_code": {
            "type": "string",
            "description": "Required text value.",
            "x-workflow-field-type": "text"
          },
          "sale_type": {
            "enum": [
              "purchase",
              "rental"
            ],
            "type": "string",
            "description": "Required selected identifier or value.",
            "x-workflow-field-type": "select"
          },
          "procedure_code": {
            "type": "string",
            "description": "Required text value.",
            "x-workflow-field-type": "text"
          }
        },
        "additionalProperties": false
      },
      "description": "Required list of structured items.",
      "x-workflow-field-type": "repeatable_group"
    },
    "dry_run": {
      "type": "boolean",
      "default": true,
      "description": "Optional true-or-false value.",
      "x-workflow-field-type": "boolean"
    },
    "document_id": {
      "description": "Required literal value or workflow expression.",
      "x-workflow-field-type": "expression"
    },
    "patient_key": {
      "description": "Required literal value or workflow expression.",
      "x-workflow-field-type": "expression"
    },
    "sales_order_key": {
      "description": "Required literal value or workflow expression.",
      "x-workflow-field-type": "expression"
    }
  },
  "additionalProperties": false
}
```

### Output schema

```json
{
  "type": "object",
  "properties": {
    "error": {},
    "changed": {},
    "dry_run": {},
    "success": {},
    "verified": {},
    "added_items": {},
    "document_id": {},
    "missing_items": {}
  },
  "additionalProperties": true
}
```
