Integrations

Field Mapping

Map form fields to integration fields with transformations.

The Field Mapping system maps form submission fields to integration-specific fields, with optional transformations.

How It Works

  1. Users configure mappings in the UI: form_field -> integration_field
  2. Optional transformations are applied during mapping
  3. Static values can be injected into the payload
  4. The FieldMapper service processes submission data and outputs integration-ready payloads

Transformations

TransformationDescriptionExample
nonePass through unchanged"Hello" -> "Hello"
uppercaseConvert to uppercase"hello" -> "HELLO"
lowercaseConvert to lowercase"HELLO" -> "hello"
trimRemove leading/trailing whitespace" hello " -> "hello"
date_isoISO 8601 date format"Jan 15, 2025" -> "2025-01-15T00:00:00+00:00"
date_usUS date format"2025-01-15" -> "01/15/2025"
booleanConvert to boolean"1" -> true
numberConvert to float"42.5" -> 42.5
integerConvert to integer"42.5" -> 42
stringConvert to string42 -> "42"
jsonConvert to JSON string["a", "b"] -> '["a","b"]'
comma_separatedJoin array with commas["a", "b"] -> "a, b"
first_itemFirst element of array["a", "b"] -> "a"
last_itemLast element of array["a", "b"] -> "b"
countCount items or string length["a", "b"] -> 2

Configuration DTO

Field mappings are represented by the FieldMappingData DTO:

use FilaForms\Integrations\Data\FieldMappingData;

$mapping = FieldMappingData::from([
    'fieldMappings' => [
        'name_field' => 'contact_name',
        'email_field' => 'email_address',
    ],
    'transformations' => [
        'email_field' => 'lowercase',
        'name_field' => 'trim',
    ],
    'staticValues' => [
        'source' => 'web_form',
        'campaign' => 'summer_2025',
    ],
    'includeUnmappedFields' => false,
]);

Using the FieldMapper Service

use FilaForms\Integrations\Services\FieldMapper;

$mapper = app(FieldMapper::class);

$submissionData = [
    'name_field' => '  Jane Doe  ',
    'email_field' => 'JANE@EXAMPLE.COM',
    'phone_field' => '555-1234',
];

$result = $mapper->map($submissionData, $mapping);

// Result:
// [
//     'contact_name' => 'Jane Doe',
//     'email_address' => 'jane@example.com',
//     'source' => 'web_form',
//     'campaign' => 'summer_2025',
// ]

The phone_field is excluded because it has no mapping defined and includeUnmappedFields is false.

Nested Field Support

Both input and output fields support dot notation for nested data:

$mapping = FieldMappingData::from([
    'fieldMappings' => [
        'address.city' => 'location.city_name',
        'address.zip' => 'location.postal_code',
    ],
]);
Copyright © 2026