> ## Documentation Index
> Fetch the complete documentation index at: https://synthetiq.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# fieldMapping

> Map and transform fields between source data and output columns

`fieldMapping` lets you rename or remap fields from source data to match your output schema columns:

```typescript theme={null}
{
  service: "shopify",
  operation: "listOrders",
  params: { limit: 10, order: "created_at desc" },
  outputTable: "raw_orders",
  outputSchema: {
    order_id: "VARCHAR",
    amount: "DOUBLE",
    status: "VARCHAR",
  },
  fieldMapping: {
    order_id: "id",
    amount: "total_price",
    status: "financial_status",
  },
}
```

| Field          | Required | Description                                    |
| -------------- | -------- | ---------------------------------------------- |
| `fieldMapping` | No       | Maps output column names to source field paths |

Values can be:

* **Dot-notation paths** — reference fields in the service response (e.g., `"orderId"`, `"response.field"`)
* **`{{item.X}}` references** — pull values from the [forEach](/docs/platform-docs/workflows-framework/foreach) source row

When `fieldMapping` is not provided, the engine matches output schema columns to response fields by name, including automatic camelCase conversion (e.g., `order_id` matches `orderId`).

## Generated values

Field mappings can generate values instead of reading from the source:

```typescript theme={null}
fieldMapping: {
  id: { generate: "cuid" },
  externalId: "source_id",
  syncedAt: { generate: "now" },
}
```

| Generator              | Output                |
| ---------------------- | --------------------- |
| `{ generate: "cuid" }` | CUID string           |
| `{ generate: "uuid" }` | UUID v4 string        |
| `{ generate: "now" }`  | Current ISO timestamp |

<Note>
  Generated values are currently available in [importFromDatabase](/docs/platform-docs/workflows-framework/steps/import-from-db) and [persistToDatabase](/docs/platform-docs/workflows-framework/steps/persist-to-db) steps only.
</Note>

## Validation

| Check                                                     |
| --------------------------------------------------------- |
| `fieldMapping` keys exist in `outputSchema`               |
| `fieldMapping` values exist in the source data            |
| `generate` values use valid types (`cuid`, `uuid`, `now`) |
