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

# Record From Fields

The `recordFromFields` method builds a complete record object from field data. This allows you to add metadata or compute additional properties beyond the basic field values.

## Implementation

```javascript theme={null}
module.exports = async ({ fields, parameters }) => {
  return {
    id: fields.id,
    fields: fields,
    // Add metadata
    raw: {
      source: 'api',
      version: '2.0',
    },
    // Compute display name
    name: `${fields.firstName} ${fields.lastName}`,
    // Add URL to view record
    url: `https://app.example.com/contacts/${fields.id}`,
  }
}
```

## Input

| Property     | Type   | Description                                           |
| ------------ | ------ | ----------------------------------------------------- |
| `fields`     | object | Processed fields (after fieldsFromApi transformation) |
| `parameters` | object | Collection parameters passed from the connection      |

## Return Value

Returns a record object with the following structure:

| Property | Type   | Description                                           |
| -------- | ------ | ----------------------------------------------------- |
| `id`     | string | Unique identifier for the record (required)           |
| `fields` | object | The field data                                        |
| `name`   | string | Display name for the record (optional)                |
| `raw`    | object | Raw data or metadata (optional)                       |
| `url`    | string | URL to view the record in the external app (optional) |

## Example

```javascript theme={null}
// Input fields:
{
  "id": "123",
  "email": "john@example.com",
  "firstName": "John",
  "lastName": "Doe"
}

// recordFromFields returns:
{
  "id": "123",
  "fields": {
    "id": "123",
    "email": "john@example.com",
    "firstName": "John",
    "lastName": "Doe"
  },
  "name": "John Doe",
  "url": "https://app.example.com/contacts/123",
  "raw": {
    "source": "api",
    "version": "2.0"
  }
}
```

## Notes

* The `id` field is required and must be a string
* The `fields` property should contain all the field data
* Use `name` to provide a human-readable identifier for the record
* The `url` property enables users to navigate to the record in the external application
