Body Mapping (Simple Field Copy)

Overview

The <body> element is the most fundamental mapper instruction in Integration Manager. It copies a field value from the incoming record to the outgoing record. You can map fields one-to-one, rename them, or limit their length with maxLength.

Complete XML Examples

Basic Field Copy (same name in and out)

When out is omitted, the field keeps its original name:

XML
<mappers>
    <loadMapper id="productMapper">
        <body in="sku"/>
        <body in="label"/>
        <body in="attribute1"/>
    </loadMapper>
</mappers>

Renaming Fields

Use in and out to map a source field to a differently named target field:

XML
<mappers>
    <loadMapper id="customerMapper">
        <body in="customer_id" out="customerId"/>
        <body in="customer_name" out="label"/>
        <body in="email_address" out="attribute1"/>
        <body in="phone_number" out="attribute2"/>
        <body in="region_code" out="attribute3"/>
    </loadMapper>
</mappers>

Limiting Field Length with maxLength

Use maxLength to truncate values that exceed a given character limit:

XML
<mappers>
    <loadMapper id="productWithLimitsMapper">
        <body in="sku" out="sku"/>
        <body in="price" out="attribute1" maxLength="100"/>
        <body in="description" out="attribute2" maxLength="255"/>
        <body in="category" out="attribute3" maxLength="50"/>
    </loadMapper>
</mappers>

How It Works

  1. in attribute -- specifies the field name in the source data (CSV column header, JSON key, or Pricefx object field).

  2. out attribute -- specifies the target field name in the Pricefx object. If omitted, the value of in is used as the output name.

  3. maxLength attribute -- truncates the mapped string value to the specified number of characters. Useful for preventing data truncation errors in Pricefx.

  4. The <loadMapper> wrapper is used for bulk data load operations (pfx-api:load). For upsert operations, use <integrateMapper> instead.

Common Pitfalls

  • Forgetting out: When out is omitted, the output field name defaults to the in value. This is convenient for same-name mappings but can cause confusion if you expect automatic camelCase conversion.

  • Case sensitivity: Field names are case-sensitive. "Sku" and "sku" are different fields.

  • maxLength on numeric fields: maxLength operates on the string representation. Applying it to numeric fields may produce unexpected truncated numbers.

  • One mapper per file: Always put exactly one mapper definition per file. Do not define multiple <loadMapper> or <integrateMapper> elements in the same file.

  • Mapper ID uniqueness: Each mapper id must be unique across all mapper files. Duplicate IDs will cause one to silently override the other.