function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
LBartonLBarton 

Trigger Validates to Prevent Duplicates Not Always Working

I have created a trigger which works to avoid duplicate contacts and leads (by email address).I tried typing in an already-existing email address and got an error message.  However, a few duplicates have cropped up.  Our company is using a program called HubSpot. If names are uploaded from HubSpot to SF, would that bypass the trigger?  I think that is what is happening, but am not sure.

 
Best Answer chosen by LBarton
LBartonLBarton
I didn't explain clearly. There are duplicates and I am supposing that they are from HubSpot.  Since you mentioned that the event will fire then I am not sure where the duplicates are coming from.  Thanks for your help.  What I needed to know is that the trigger is supposed to be effective for updates from HubSport. You let me know that it is.

All Answers

Balaji BondarBalaji Bondar
Hi Lbarton,

Your trigger will not bypass the names uploaded from HubSpot to SF and will fire for all the records based on event.You have to populate a custom field on Lead and Contact which should indicate that the record is uploaded from HubSport to SF.
In Trigger , you can check this custom field value and perform the duplicate check accordingly for Leads and Contacts.
LBartonLBarton
Thanks! I know how to add a new custom field but how do I find out if a record is uploaded from HubSpot?
 
Balaji BondarBalaji Bondar
You will have to update this field along with the other existing field updates from HubSpot with specific value.
Update trigger with this criteria to bypass the records in the trigger.
LBartonLBarton
I didn't explain clearly. There are duplicates and I am supposing that they are from HubSpot.  Since you mentioned that the event will fire then I am not sure where the duplicates are coming from.  Thanks for your help.  What I needed to know is that the trigger is supposed to be effective for updates from HubSport. You let me know that it is.
This was selected as the best answer