Skip to content

Commit

Permalink
fix logic for unsubscribed
Browse files Browse the repository at this point in the history
  • Loading branch information
keyn4 committed Jun 19, 2024
1 parent e4c5c38 commit c85a7cb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions target_salesforce_v3/sinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ def preprocess_record(self, record: dict, context: dict):

if record.get("company") and not record.get("company_name"):
record["company_name"] = record["company"]

# if unsubscribed is not get value from unsubscribed_status
# assign value to unsubscribed because unsubscribed_status is not a valid model field
record["unsubscribed"] = record.get("unsubscribed") if record.get("unsubscribed") is not None else record.get("subscribe_status") == "unsubscribed"

record = self.validate_input(record)

Expand Down Expand Up @@ -77,9 +81,7 @@ def preprocess_record(self, record: dict, context: dict):
"Salutation": salutation,
"Birthdate": birthdate,
"OwnerId": record.get("owner_id"),
"HasOptedOutOfEmail": record.get("unsubscribed")
if record.get("unsubscribed") is not None
else record.get("subscribe_status") == "unsubscribed",
"HasOptedOutOfEmail": record.get("unsubscribed"),
"NumberOfEmployees": record.get("number_of_employees"),
"Website": record.get("website"),
"Industry": industry,
Expand Down

0 comments on commit c85a7cb

Please sign in to comment.