From 7bd544287a38bd17bba29402665073045bb46c1a Mon Sep 17 00:00:00 2001 From: Keyna Rafael <95432445+keyn4@users.noreply.github.com> Date: Mon, 28 Oct 2024 17:15:54 -0500 Subject: [PATCH] bump record cleaning logic to keep id and externalid (#26) --- target_salesforce_v3/sinks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target_salesforce_v3/sinks.py b/target_salesforce_v3/sinks.py index daf0c6d..b40b101 100644 --- a/target_salesforce_v3/sinks.py +++ b/target_salesforce_v3/sinks.py @@ -884,9 +884,9 @@ def preprocess_record(self, record, context): return {} # keep only available fields and that are creatable or updatable - record = {k:v for k,v in record.items() if fields.get(k) and (fields[k]["createable"] or fields[k]["updateable"])} + record = {k:v for k,v in record.items() if fields.get(k) and (fields[k]["createable"] or fields[k]["updateable"] or k.lower() in ["id", "externalid"])} # clean empty date fields to avoid salesforce parsing error - record = {k:v for k,v in record.items() if fields[k].get("type") not in ["date", "datetime"] or (fields[k].get("type") in ["date", "datetime"] and v)} + record = {k:v for k,v in record.items() if fields.get(k, {}).get("type") not in ["date", "datetime"] or (fields.get(k, {}).get("type") in ["date", "datetime"] and v)} # add object_type record["object_type"] = object_type