# UpdateSalesItem

## Permission Scope

salesItem

## Overview

UpdateSalesItem changes the selling defaults of an already adopted item.

## Business Rules

- The referenced item must already hold a selling record
- Only fields present in the input are changed; absent fields keep their stored values
- Changing `requiresPhysicalFulfillment` affects only lines entered afterwards — existing sales order lines keep the value they froze at entry
- Host-defined custom fields are persisted alongside the builtin columns; a builtin column always wins over a custom field of the same name

## Process Flow

```mermaid
flowchart TD
    A[Receive update request for an item] --> B{Item has a selling record?}
    B -->|No| C[Return ITEM_NOT_SELLABLE]
    B -->|Yes| D[Apply the present fields to the record]
    D --> E[Return updated selling record]
```

## External Dependencies

- None

## Error Scenarios

- **ITEM_NOT_SELLABLE**: Referenced item holds no selling record and cannot be sold

## Test Cases

- updates the fulfillment expectation of an adopted item
- leaves stored values unchanged for fields absent from the input
- returns error when the item has no selling record
- persists host-defined custom fields alongside the builtin columns
