Skip to content

Commit

Permalink
fix: hubspot: hs_additional_email comparision logic
Browse files Browse the repository at this point in the history
  • Loading branch information
anantjain45823 committed Apr 16, 2024
1 parent 0b57204 commit 056df76
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/v0/destinations/hs/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 056df76

Please sign in to comment.