# Set fields

> Sets, renames or calculates fields without code. A value can mix text with details found, or be a sum such as the total times 1.17. A date can take a layout, such as {email.receivedAt:MM/yyyy} for 10/2026.

Source: https://docs.go-lumen.ai/reference/steps/set-fields

## At a glance

| Property | Value |
| --- | --- |
| **Step name** | `set-fields` |
| **Resource** | ClusterStep (`lumen.ai/v1alpha1`) |
| **Palette group, category** | control, logic |
| **Credits** | **0.5** credits each time it succeeds |
| **Side effects** | no |
| **Installation must provide** | nothing |

## Inputs

| Property | Value |
| --- | --- |
| **Needs** | nothing |
| **Produces** | `fields` |
| **Works on** | item: one document at a time |

Needs and Produces are data types (file, text, fields, email). The editor offers a step only where what it needs is already on the path. See [Documents and data](https://docs.go-lumen.ai/concepts/how-flows-run.md#documents-and-data).

## Outputs

More outputs are declared in the setting \`fields\`.

## Settings

Set under `config:` on the flow node. Text settings may contain `{nodeId.field}` placeholders.

| Setting | Type | Default | Description |
| --- | --- | --- | --- |
| `fields` (required) | list of object |  | Fields (minItems 1; maxItems 50) |
| `fields[].name` (required) | string |  | Name is the field, for the steps after this one. A name already there is replaced, so this also renames: set the new name to `{old}`. (minLength 1; maxLength 64; pattern \`^\[^{}.\]+$\`) |
| `fields[].value` (required) | string |  | A date can be written with a layout: `{read.date:MM/yyyy}` gives 10/2026. Layouts use yyyy, yy, MM and dd, and MMM for the month name in English (Oct). (maxLength 500) |
| `fields[].type` | string |  | Type is what the value is. Unset, it follows the value: a calculation over number fields is a number, anything else is text. (one of string, number, date, boolean) |

The full JSON Schema of these settings: [set-fields.schema.json](https://docs.go-lumen.ai/schemas/steps/set-fields.schema.json).

## Example

Add VAT to a price

```yaml title="config"
fields:
- name: priceWithVat
  type: number
  value: '{price} * 1.18'
```

## Use it in a flow

A node that runs `set-fields` goes under `spec.nodes` of a [Flow](https://docs.go-lumen.ai/concepts/how-flows-run.md#the-flow-as-yaml). Give it any id, and list the next node ids in next.

```yaml title="flow.yaml"
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
  name: set-fields-example
  namespace: tenant-acme
spec:
  displayName: "Set fields"
  triggers:
    - id: start
      ref: {name: manual-run}
      next: [set-fields]
  nodes:
    - id: set-fields
      stepRef: {name: set-fields}
      config:
        fields:
        - name: priceWithVat
          type: number
          value: '{price} * 1.18'
```
