Automation Answers

Why Are My Line Items Not Mapping Correctly?

Line items map incorrectly when parallel arrays have different lengths, a destination expects one item instead of a list, or an iterator separates fields.

Short answer

Why Are My Line Items Not Mapping Correctly?

Line items map incorrectly when parallel arrays have different lengths, a destination expects one item instead of a list, or an iterator separates fields that must stay together. Inspect the raw arrays, confirm each index describes the same item, then use the destination’s line-item fields or iterate over complete item objects.

Common causes

  • Product, quantity, and price arrays contain different item counts.
  • A scalar field is mapped where the action expects a line-item array, or vice versa.
  • Text was split with a delimiter that also appears inside values.
  • An iterator receives separate arrays rather than an array of complete objects.

Diagnostic steps

  1. Inspect the source output and count every related array.
  2. Confirm index zero across arrays belongs to one item, then check all remaining indexes.
  3. Build complete item objects before iterating, or map matching arrays into native line-item fields.
  4. Test with zero, one, and several items, including blank optional fields.

Example

Three product names arrive with only two quantities, shifting the final mapping. Supply a validated quantity for every product before creating invoice lines.

Caveats

A successful editor test with one item does not validate multi-item behavior. Never assume comma-separated text is a safe array format.