Skip to main content

Field Mapping Configuration

Field mappings define how data from external connectors is translated into GTM Clarity's canonical schema. Each connector provides default mappings, but admins can customize them to match their specific data model.

How Field Mapping Works

When a connector syncs data, each record passes through the field mapping layer. The mapper reads the configured mappings for that connector and entity type, applies any transforms, and outputs a canonical record for storage.

Field Mapping Table

Mappings are stored in the field_mappings table:

ColumnTypeDescription
idtext (UUID)Primary key
tenant_idtextTenant scope
connector_idtextFK to connectors
entity_typetextaccount, person, opportunity, or activity
mappingsjsonbArray of FieldMappingEntry objects
is_defaultbooleanWhether this is the system default mapping

A unique index on (tenant_id, connector_id, entity_type) ensures one mapping set per connector per entity type.

Mapping Entry Structure

Each entry in the mappings array follows this structure:

interface FieldMappingEntry {
sourceField: string; // Field name in the source system
targetField: string; // Field name in the canonical schema
transform: "none" | "lowercase" | "uppercase" | "trim" | "custom";
customTransform?: string; // Expression for custom transforms
required?: boolean; // Whether this field must be present
}

Example: Salesforce Account Mapping

[
{
"sourceField": "Name",
"targetField": "name",
"transform": "trim",
"required": true
},
{
"sourceField": "Website",
"targetField": "domain",
"transform": "lowercase"
},
{
"sourceField": "Industry",
"targetField": "industry",
"transform": "none"
},
{
"sourceField": "NumberOfEmployees",
"targetField": "employeeCount",
"transform": "none"
},
{
"sourceField": "AnnualRevenue",
"targetField": "annualRevenue",
"transform": "none"
}
]

Transform Options

TransformBehaviorUse Case
nonePass through unchangedNumeric fields, IDs
lowercaseConvert to lowercaseEmail addresses, domains
uppercaseConvert to uppercaseCountry codes, state abbreviations
trimRemove leading/trailing whitespaceNames, free-text fields
customApply custom expressionComplex transformations
tip

Use the lowercase transform on email and domain fields to ensure consistent matching and deduplication across data sources.

Default Mappings Per Connector

Each connector ships with sensible defaults. These are created automatically when a connector is first added.

Salesforce Defaults

Source FieldTarget FieldEntity
NamenameAccount
WebsitedomainAccount
IndustryindustryAccount
NumberOfEmployeesemployeeCountAccount
AnnualRevenueannualRevenueAccount
EmailemailPerson
FirstNamefirstNamePerson
LastNamelastNamePerson
TitletitlePerson
PhonephonePerson
StageNamestageOpportunity
AmountamountOpportunity
CloseDatecloseDateOpportunity

Customer.io Defaults

Source FieldTarget FieldEntity
emailemailPerson
first_namefirstNamePerson
last_namelastNamePerson
event_nametypeActivity
timestampoccurredAtActivity

Custom Field Mapping

To override default mappings:

  1. Navigate to Settings > Connectors > [Connector Name] > Field Mappings
  2. Select the entity type (Account, Person, Opportunity, Activity)
  3. Modify existing mappings or add new ones
  4. Click Save to apply changes

Custom mappings override the defaults entirely for that entity type. Any fields not included in your custom mapping will not be imported.

warning

If you remove a required field mapping (like name for accounts or email for people), sync operations may fail or produce incomplete records. Always verify your mappings after changes.

Writeback Field Maps

In addition to inbound mappings, GTM Clarity supports writeback -- pushing computed scores back to the source system. Writeback mappings define which canonical score fields map to which target fields in the CRM.

The writeback_configs table stores these mappings:

ColumnTypeDescription
idtext (UUID)Primary key
tenant_idtextTenant scope
connector_idtextFK to connectors
entity_typetextaccount, person, or opportunity
field_mapjsonbArray of WritebackFieldMap
enabledbooleanWhether writeback is active
last_writeback_attimestamptzLast successful writeback
last_writeback_errortextError from last attempt

Writeback Field Map Structure

interface WritebackFieldMap {
canonicalField: "fitScore" | "engagementScore" | "combinedScore" | "tier" | "scoredAt";
targetField: string; // Field name in the CRM
}

Example: Salesforce Writeback

[
{ "canonicalField": "fitScore", "targetField": "GTM_Fit_Score__c" },
{ "canonicalField": "engagementScore", "targetField": "GTM_Engagement_Score__c" },
{ "canonicalField": "combinedScore", "targetField": "GTM_Combined_Score__c" },
{ "canonicalField": "tier", "targetField": "GTM_Tier__c" },
{ "canonicalField": "scoredAt", "targetField": "GTM_Scored_At__c" }
]
info

Writeback requires custom fields to exist in the target CRM. For Salesforce, create custom fields via Setup > Object Manager before enabling writeback. The Salesforce Metadata API can be used to discover available fields.