From 6d37d6394abd392ea85d1f762ee2e82315a6813c Mon Sep 17 00:00:00 2001 From: Sankaran Nepolean Date: Fri, 22 Feb 2019 06:55:36 +0000 Subject: [PATCH] Update MetadataUtil.cls This has fix for, 1) allowing blank values in rows 2) bug fix for passing field values along with "" for upsert --- custom_md_loader/classes/MetadataUtil.cls | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/custom_md_loader/classes/MetadataUtil.cls b/custom_md_loader/classes/MetadataUtil.cls index a1e6650..2dba9d8 100644 --- a/custom_md_loader/classes/MetadataUtil.cls +++ b/custom_md_loader/classes/MetadataUtil.cls @@ -87,9 +87,17 @@ public class MetadataUtil { List fieldValueList = new List(); for (String singleRowFieldValues :singleRowOfValues) { - if (String.isBlank(singleRowFieldValues)) { + + // Sankaran - not sure why to continue when the value is blank. This will not allow to insert null + // values for a field. So, commenting it. + /*if (String.isBlank(singleRowFieldValues)) { continue; - } + }*/ + + // Sankaran - If the field value has ", for example, "A (B), C", it is passed along with double quotes + // for upsert. So, we need to extract string ignoring " before passing for upsert. + if (singleRowFieldValues.startsWith('"') && singleRowFieldValues.endsWith('"')) + singleRowFieldValues = singleRowFieldValues.substring(1, singleRowFieldValues.length()-1); fieldValueList.addAll(singleRowFieldValues.split(';')); }