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
- Inspect the source output and count every related array.
- Confirm index zero across arrays belongs to one item, then check all remaining indexes.
- Build complete item objects before iterating, or map matching arrays into native line-item fields.
- 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.