---
title: Record
description: Reference for the Record type, an immutable map of fields to values.
---

# Record

A record is an immutable map of fields to values (i.e., `Map<String,?>`). Each value can have its own type.

A record can be created using the `record` function:

```nextflow
sample = record(id: '1', fastq_1: file('1_1.fastq'), fastq_2: file('1_2.fastq'))
```

Record fields can be accessed as properties:

```nextflow
sample.id
// -> '1'
```

The following operations are supported for records:

##### `+ : (Record, Record) -> Record`

Given two records, returns a new record containing the fields and values of both records. When a field is present in both records, the value of the right-hand record takes precedence.

The following methods are available for a record:

##### `subMap( keys: Iterable<String> ) -> Record`

Returns a new record containing only the given fields.
