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
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
// Input fields:
{
  "id": "123",
  "email": "[email protected]",
  "firstName": "John",
  "lastName": "Doe"
}
// recordFromFields returns:
{
  "id": "123",
  "fields": {
    "id": "123",
    "email": "[email protected]",
    "firstName": "John",
    "lastName": "Doe"
  },
  "name": "John Doe",
  "url": "https://app.example.com/contacts/123",
  "raw": {
    "source": "api",
    "version": "2.0"
  }
}Notes
- The 
idfield is required and must be a string - The 
fieldsproperty should contain all the field data - Use 
nameto provide a human-readable identifier for the record - The 
urlproperty enables users to navigate to the record in the external application 
Updated 10 days ago
