<!-- TIER:1 -->
Writing Mappings and Transforms
Mappings and transforms are the data reshaping layer in Celigo integrations. They control how fields from one system translate into fields for another. Mappings are used across flows, APIs, and tools.
Mapping Systems
Four systems handle data reshaping:
- Mapper 2.0 -- modern recursive field mapping on imports ( array). Handles nested objects, arrays of any depth, lookups, conditionals, and date conversions. Default for new imports on all adaptor types except NetSuite and Salesforce
- Mapper 1.0 -- legacy flat mapping on NetSuite and Salesforce imports ( / ). Body-level and sublist fields in separate flat arrays. Also present on many older HTTP/FTP/RDBMS imports created before Mapper 2.0 existed
- Transformation 2.0 -- rule-based data reshaping on exports (
transform.expression.rulesTwoDotZero
). Uses the same Mapper 2.0 schema internally. Two modes: "create" (build new record from scratch) or "modify" (edit fields on existing record, unmapped fields pass through)
- Response mapping -- simple extract/generate pairs that carry data from a lookup or import response back into the record ( on flow ). Uses Transformation 1.0 syntax
Lookups are shared across all systems -- static key-value maps or references to LookupCache resources for large/dynamic datasets. NetSuite imports use a distinct lookup system that queries live NetSuite records.
Direction decides the tool. Mappings translate data going out to a destination -- every import needs them, because the in-flight record almost never matches what the destination expects. Transformations reshape data coming in -- on exports, listeners, and API/tool entry stages. Never use an upstream transformation to match a destination's shape; that's the destination import's mapping. Transformations earn their keep in two situations: multiple sources feeding one pipeline (reshape each new source to the canonical record shape the existing steps expect) and genuinely messy source data (flatten deep nesting once at entry instead of fighting it in every downstream mapping). With a single well-shaped source, don't add a transform just because you can -- and skip identity transforms that rename nothing.
Quick Reference
Which Mapping System?
| Context | System | Syntax | Read schema |
|---|
| Import field mapping (HTTP, RDBMS, FTP, S3, etc.) | Mapper 2.0 | | mappings.yml |
| NetSuite/Salesforce import | Mapper 1.0 | | see import schema (netsuitedistributed.yml, salesforce.yml) |
| Export data reshaping | Transformation 2.0 | | transform.yml |
| Response mapping (lookup/import carry-back) | Transformation 1.0 | extract/generate pairs | response-mapping.yml |
| Value translation | Lookups | | lookups.yml |
Editing existing imports: Many existing imports use Mapper 1.0 even for HTTP and RDBMS adaptor types (pre-dating Mapper 2.0). Always check whether an import uses
(2.0) or
(1.0) before modifying -- never mix the two.
Schema Index
| Schema | Contents |
|---|
| mappings.yml | Mapper 2.0 field definitions (generate, extract, dataType, buildArrayHelper, conditionals) |
| lookups.yml | Static and dynamic lookup definitions |
| transform.yml | Transformation 2.0 envelope (mode, expression, script) |
| response-mapping.yml | Transformation 1.0 extract/generate pairs for response carry-back |
| netsuitedistributed.yml | NetSuite Mapper 1.0 mapping + lookups |
| salesforce.yml | Salesforce Mapper 1.0 mapping |
Related Skills
- configuring-imports > Quick Reference -- import adaptor types, operation logic, hooks
- configuring-exports > Quick Reference -- export adaptor types, delta syncs, webhooks
- writing-handlebars > Quick Reference -- Handlebars expressions used inside mapping fields
- building-flows > How to Build a Flow -- wiring exports and imports into a flow pipeline
<!-- TIER:2 -->
Mapper 2.0 Workflow
The
array is
recursive -- a mapping can contain nested child mappings of the same structure to any depth. This is the core design principle.
1. Check the existing resource
Before modifying mappings, always retrieve the current state of the resource. Check whether it uses Mapper 2.0 (
) or Mapper 1.0 (
).
bash
celigo imports get <importId>
celigo account search <keyword>
2. Understand the source data shape
Invoke the upstream export to see real records, or query the source system's metadata for the full field list.
bash
celigo exports invoke <exportId>
celigo metadata fields <sourceConnectionId> <entityType>
3. Understand the target data shape
Query metadata for the target system to discover required fields and types.
bash
celigo metadata types <targetConnectionId>
celigo metadata fields <targetConnectionId> <entityType>
4. Choose the input context
The input context controls what data is available to extract paths. Set via the "Input context" dropdown in the mapper UI:
- (default) -- extract paths reference the record directly. accesses the field on the record
- -- extract paths reference a wrapper object containing , , (with , , , ), , and . Record fields shift to , but you gain access to metadata like
$.settings.connection.api_username
, , $.settings.flow.fieldName
When to use envelope: APIs and tools where you need request context (headers, path params, query params, connection settings) directly in mappings without Handlebars. Also useful on transforms at the beginning of API/tool steps where the envelope exposes the full request context. Envelope context eliminates the need for
{{settings.connection.fieldName}}
Handlebars expressions -- use
$.settings.connection.fieldName
instead.
5. Map by data type
Every mapping needs three properties:
(target field name),
(output type), and
(how to get data from source).
Extract supports three patterns (distinguished by syntax):
- JSON path -- starts with (e.g., ). Always references the top-level root, even in nested mappings
- Handlebars -- contains (e.g.,
{{record.firstName}} {{record.lastName}}
). For computed values
- Hard-coded -- plain string literal (e.g., , ). Neither prefix nor
Simple types (string, number, boolean, date) -- direct field-to-field mapping. For dates, set
/
for conversion.
Objects -- set
, add child mappings in the
array. Never use dot notation in
.
Arrays -- set
to an array type (
,
,
,
,
) and configure
. Three patterns for object arrays:
- Extract only -- pull existing objects from source ()
- Mappings only -- construct objects from individual fields (each entry creates one array element)
- Extract + mappings -- iterate a source array and reshape each element. Uses the composite object mechanism: array brackets in the extract path collapse to single objects inside the mappings, so becomes in child extract paths. Parent context remains accessible (e.g., , )
6. Add lookups for value translation
Define lookups alongside mappings and reference them by name via
on any mapping.
- Static -- object with key-value pairs. Best for small, fixed sets (country codes, status values)
- Dynamic -- referencing a LookupCache resource, with optional JSON path to pull a specific field from the cached object
- Set + to continue processing when lookup keys are missing
7. Add conditionals where needed
Control when a mapping applies:
(only on insert),
(only on update), or
(skip when source is null/empty).
Schema reference
All Mapper 2.0 field definitions: mappings.yml, lookups.yml
Transformation 2.0 Workflow
Transformation 2.0 reshapes data on exports before it enters the pipeline. It wraps Mapper 2.0 syntax in a transform envelope with a mode selector.
1. Check the existing resource
Before modifying transforms, retrieve the current export to inspect any existing transform configuration.
bash
celigo exports get <exportId>
celigo account search <keyword>
2. Choose the mode
- -- build a completely new record. Only mapped fields appear in output. Use when the output structure differs significantly from the source
- -- edit specific fields on the existing record. Unmapped fields pass through unchanged. Use for surgical adjustments (rename, add, remove a few fields)
3. Write the mappings
Same Mapper 2.0 syntax:
,
,
, nested
,
, lookups. Everything described in the Mapper 2.0 section above applies here, including input context.
Input context is especially valuable on transforms for APIs and tools -- set it to
to access the full request context (headers, path params, query params, connection settings) directly via JSON path instead of Handlebars.
4. Configure the transform envelope
Set
transform.type: "expression"
,
, then place
and
under
expression.rulesTwoDotZero
with the chosen
.
Script alternative: Set
with
and
for programmatic transforms when expression rules aren't sufficient.
Schema reference
All Transformation 2.0 field definitions: transform.yml, mappings.yml, lookups.yml
Mapper 1.0 Reference (NetSuite and Salesforce)
NetSuite and Salesforce imports use the older flat mapping structure. Two arrays within the
object:
- -- body-level field mappings. Each entry has (source path) or (static value), (target field ID), and optional , , , , ,
- -- sublist/line-item mappings. Each entry has (sublist ID, e.g., ), (source array path), and (column mappings with the same properties as body fields, plus for matching existing lines)
NetSuite lookups are different -- they query live NetSuite records using
,
,
, and
. Not static maps. Defined in
, referenced by
in field mappings. To discover valid field IDs for
and
, run
celigo metadata fields <connectionId> <recordType>
— the returned field IDs are the exact values to use.
Salesforce lookups follow the same Mapper 1.0 pattern but the lookup structure is simpler.
Sublist field discovery: For NetSuite
, the sublist name (e.g.,
,
) comes from
celigo metadata fields <connectionId> <recordType>
— sublists appear as field groups. For Salesforce related lists, use
celigo metadata fields <connectionId> <sObjectType>
to discover relationship fields and child object names for
distributed.relatedLists[].sObjectType
.
Schema reference
NetSuite Mapper 1.0: see
and
in the configuring-imports skill's
netsuitedistributed.yml
Salesforce Mapper 1.0: see
in the configuring-imports skill's
salesforce.yml
Response Mapping Reference (Transformation 1.0)
Response mapping extracts fields from a lookup or import API response back into the original record. It lives on the flow's
entry, not on the resource itself -- but it's planned when building the resource.
Two sections:
- -- field-level extract/generate pairs using dot notation
- -- array mappings with (target array name) and (column mappings)
For lookup exports: the response contains
and
. Use
for single results,
when multiple results are expected.
For imports: the response is available via
. Use
(e.g.,
for a created record's ID,
_json.output.1.content.0.text
for AI model responses).
Schema reference
All response mapping field definitions: response-mapping.yml
CLI Commands
bash
# Discover resources
celigo account search <keyword> # Find imports/exports by name
celigo imports get <importId> # Inspect existing import (check mappings vs mapping)
celigo exports get <exportId> # Inspect existing export (check transform)
# Understand data shapes
celigo exports invoke <exportId> # See real source records
celigo metadata types <connectionId> # List entity types
celigo metadata fields <connectionId> <type> # List fields for an entity
# Update mappings (GET -> modify -> PUT)
celigo imports set <importId> <key>=<value> [<key2>=<value2> ...] # Field-level edit (dot/bracket paths, JSON values)
celigo exports set <exportId> <key>=<value> [<key2>=<value2> ...]
celigo imports update <importId> < import.json # Full PUT replace from stdin JSON
celigo exports update <exportId> < export.json
<!-- TIER:3 -->
Pre-Submit Checklist
Before submitting any mapping configuration, verify:
Gotchas
- Existing imports may use Mapper 1.0 even for HTTP/RDBMS/FTP. Mapper 2.0 is the default for new imports, but many older imports across all adaptor types use Mapper 1.0. Always check the existing format before editing -- means 2.0, means 1.0. Never mix.
- Extract paths always reference the root of the input context. Even in deeply nested Mapper 2.0 mappings, paths start from the top level (the record in context, or the envelope in context), not the current nesting level.
- Composite object collapses arrays to single objects. When has both and , array brackets in the extract path are replaced with single objects in child mapping contexts. becomes inside the mappings.
- Response mapping uses Transformation 1.0 syntax, not 2.0. Don't use structure in . It uses simple extract/generate pairs with dot notation.
- NetSuite lookups query live data. A NetSuite import's searches NetSuite records at runtime (, , ), unlike Mapper 2.0 static lookups.
- must not use dot notation in Mapper 2.0. Build nested structures with and child .
"generate": "customer.name"
silently creates a field literally named .
- Empty indicates inner array in . For nested array structures, inner array mappings have no field -- this is expected, not an error.
- Transformation 2.0 "modify" passes through unmapped fields. "Create" mode only outputs explicitly mapped fields. Choose based on whether you want a clean slate or surgical edits.
- PUT erases omitted fields on the parent resource. When updating mappings on an import or transform on an export, always GET the full resource first, modify the mapping/transform section, then PUT the complete object. The command handles this.
Common Errors
| Error | Cause | Fix |
|---|
| "Mapping object must have status field present" | Missing on a mapping entry | Add to every mapping object |
| Import silently creates field named | Dot notation in | Use nested with child |
| Mapped fields missing in output | Using Mapper 2.0 syntax on a Mapper 1.0 import (or vice versa) | Check existing format: = 2.0, = 1.0 |
| Extract returns in nested mapping | Extract path relative to nesting level | Extract paths always start from root (), not the current level |
| Array output is empty | Missing on array dataType | Add for all dataTypes |
| Lookup key not found / processing stops | not set on lookup | Set and provide a value |
| Response mapping not applied | placed on the import resource | Move to entry for that import |
| Composite object paths return wrong data | brackets still in child extract paths | Drop -- arrays collapse to single objects inside mappings |
| Date values malformed in output | Missing date format configuration | Set and on date mappings |
| PUT overwrites entire resource | Partial JSON sent without GET first | Always GET full resource, modify mapping section, PUT complete object |