Skip to content

Commit

Permalink
clean empty datetime fields in fallback sink
Browse files Browse the repository at this point in the history
  • Loading branch information
keyn4 committed Oct 22, 2024
1 parent 9a56fcb commit a9e7ef3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions target_salesforce_v3/sinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,13 @@ def preprocess_record(self, record, context):
except MissingObjectInSalesforceError:
self.logger.info("Skipping record, because it was not found on Salesforce.")
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"])}
# 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)}

# add object_type
record["object_type"] = object_type

# If lookup_fields dict exist in config use it to check if the record exists in Salesforce
Expand Down

0 comments on commit a9e7ef3

Please sign in to comment.