-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: hubspot: hs_additional_email comparision logic
- Loading branch information
1 parent
0b57204
commit 056df76
Showing
1 changed file
with
8 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -752,11 +752,18 @@ const splitEventsForCreateUpdate = async (inputs, destination) => { | |
} | ||
const secondaryProp = primaryToSecondaryFields[identifierType]; | ||
if (secondaryProp) { | ||
// second condition is for secondary property for identifier type | ||
/* second condition is for secondary property for identifier type | ||
For example: | ||
update[secondaryProp] = "[email protected];[email protected];[email protected]" | ||
destinationExternalId = "[email protected]" | ||
So we are splitting all the emails in update[secondaryProp] into an array using ';' | ||
and then checking if array includes destinationExternalId | ||
*/ | ||
const filteredInfoForSecondaryProp = hsIdsToBeUpdated.filter((update) => | ||
update[secondaryProp] | ||
?.toString() | ||
.toLowerCase() | ||
.split(';') | ||
.includes(destinationExternalId.toString().toLowerCase()), | ||
); | ||
if (filteredInfoForSecondaryProp.length > 0) { | ||
|