I have been researching this, and am coming up with very little. I'm coming here before I attempt talking to Salesforce.


I've noticed in the past 2+ months that when inserting a new record, via the GUI, that you cannot search for (let's assume) that EMAIL address and find the record right away all of the time. It's very noticeable versus prior experience where you seemingly could immediately search and find it right after creating it (again, via the GUI). My guess is (perhaps to make SF overall work better?) they are not updating the Index immediately? Or similar, that when I do this insert on "server7", it is taking LONGER for it to get to "server12" in that Instance, causing it to not show up "immediately" when querying "server 12". This is all guesswork, of course.


We have had an ongoing problem for literally years with the following logic, done via API calls from PHP code:

  1. web visitor clicks SUBMIT to put themselves into Salesforce
  2. PHP talks to SF via API, sees if they exist in Contact, then Lead
  3. IF THEY DO EXIST, data is stored/edited on the pre-existing record
  4. IF THEY DO NOT EXIST, a Lead is created

The problem is, no matter how many developers get involved over the years, no matter how they re-do the PHP side of things... we get duplicates. We actually get 25-50 duplicates (2-3 PER EMAIL ADDRESS usually) per day. (Email Address is our unique key in this case)

When JohnBob comes to the site and submits himself, then submits himself again, then goes to a different page and submits himself a third time, sometimes he gets in as a new Lead THREE TIMES. Again, my belief that the Index is slow to update and subsequent searches for him fail.

Any thoughts? If this "queue" exists (which holds JohnBoy until he is actually inserted), I'd want the PHP to check THAT as well after checking Contact and Lead.

UPDATE regarding my "server7" "server12" comments... I'm implying different database servers within the same instance (in my case, NA4), and basic "clustering" and "mirroring" technology - the record INSERTING on one server, and "Eventually" making it to the OTHER servers.

Attempts to find related Questions include: Delaying Trigger until all related records are inserted? Delay from Salesforce.com in querying records, Informatica Why sites has a delay when I'm working with data?

  • Are you using SOQL, SOSL, or a custom service of some sort (webservice or @RestResource)?
    – sfdcfox
    Commented Jan 7, 2015 at 22:27
  • I... do not have an answer, and our Dev team has rolled over a couple times at LEAST since the logic in question was last tweaked enough for anyone to be knowledgeable. (sigh) ((continued......))
    – AMM
    Commented Jan 12, 2015 at 21:06
  • ((...continuation)) I will have to investigate. :-/ My believe is, via simple PHP, they are just "querying" SF directly and asking "is there a Contact with this email?".... "NO? Is there a Lead with this email?"... "NO? Then create a Lead" (that is the logic required). I'm fearful that after they "create a lead" that there is a delay of milliseconds to seconds, where ANOTHER attempt to submit does the same logic check, does not find it AGAIN, even though the previous submit is "in progress".
    – AMM
    Commented Jan 12, 2015 at 21:07
  • That's a terribly naive method for attempting to prevent duplicates and is certainly prone to delays, but not by virtue of the database cluster. It's 100% impossible to get duplicates if you're using proper row locking, either by unique indexes or row-locking database statements, which can only happen in Apex Code.
    – sfdcfox
    Commented Jan 12, 2015 at 22:05
  • Until a little over a year ago, we only had PHP developers, so all such logic HAD to exist at the PHP level. Your assertion, however, about doing this at the Apex level, makes a lot of sense. :-/ .
    – AMM
    Commented Jan 12, 2015 at 22:31

1 Answer 1


Ultimately, the way to do this in Salesforce, as of the time that they acquired their Dupe Blocker functionality, is to use Data.Com duplication tools now provided.

Setup >> Data.Com Administration >> Duplicate Management

LINK: Manage Duplicate Records In Salesforce

It does a relatively good job of avoiding duplication either via reporting or enforcing, even cross object (Lead/Contact/Account). It's not perfect, and can get convoluted if you try to get specific in your desired duplicate checking rules, but it's far better than having nothing to stop Leads/Contacts/etc from allowing dupes.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .