CustomMetadataLoader icon indicating copy to clipboard operation
CustomMetadataLoader copied to clipboard

The number of field values does not match the number of header fields on line2

Open ktheralaSFDC opened this issue 5 years ago • 5 comments

The number of field values does not match the number of header fields on line2, this is the error if i have fields with empty values, any workarounds ?

ktheralaSFDC avatar Aug 09 '20 17:08 ktheralaSFDC

Any update on this having the same issue, Is this the issue because we have empty values ?

chaitanyakurella avatar Sep 16 '20 00:09 chaitanyakurella

@ktheralaSFDC @chaitanyakurella From custom_md_loader/classes/MetadataUtil.cls remove lines 90-92

if (String.isBlank(singleRowFieldValues)) {
    continue;
}

Usman8286 avatar May 11 '21 19:05 Usman8286

A few more gotchas that seem to trigger this problem: make sure you don't have any text fields whose values contain delimiter characters. Probably not an exhaustive list, but I think these characters cause issues in text fields:

  • comma (,)
  • semi-colon (;)
  • single-quote (')
  • double-quote (")

I had to remove these from my batch upload, then manually re-enter the values afterwards.

In addition, Number and Percent fields do not seem to handle blank values in the CSV. All types of Text fields can be blank, as can Boolean and Picklist. For my number fields, I inputted an easy-to-identify number that matched the range (like 999), then manually deleted these values after the upload. Not sure about some of the more exotic fields like URL, but if you are still hitting the problem I would experiment with adding placeholder values field type by field type to see if there is another one besides number that's causing problems.

hapaxio avatar Jul 24 '21 20:07 hapaxio

When I try to update a string field with blanks, I get "The number of field values does not match the number of header fields on line1", how do I update to blanks (empty values)?

necoyama3 avatar Nov 10 '22 06:11 necoyama3

Duplicate of https://github.com/forcedotcom/CustomMetadataLoader/issues/9

alex-wilson-gwf avatar Apr 27 '23 05:04 alex-wilson-gwf