Yeah when comment chains get very long we moderators sometimes clean them up. Often I will migrate them into chat, but if it looks like the issue is completely resolved sometimes I just remove them altogether. I can restore these particular comments if you feel they still add value, or migrate them to chat. It just seemed like the problem was solved.
For posterity here's what was written:
I just observed the logs on Apex debug console while making the request again from my failed queue, and I see this: 01:55:23:077 DUPLICATE_DETECTION_MATCH_INVOCATION_DETAILS EntityType:Lead|ActionTaken:Allow_[Alert,Report]|DuplicateRecordIds:00Q1r00001CojKl. The Duplicate ID that Salesforce cries about by no way has the same email that is being inserted. Two different emails entirely. I am confused.
– Ali Gajani
Please see my updated screenshot on OP.
– Ali Gajani
Thanks Daniel for your help. This is not true. The Lead ID that Salesforce claims is being duplicated has a different email and No Contact at all..
– Ali Gajani
And yes my that Rule is indeed active :Lead with Duplicate contacts. Should I disable it. But it doesn't seem to do with contacts. The error logs purely refer to Lead Duplication(?)
– Ali Gajani
Disabling that rule would need to be a call for whoever admin's that org. I'd assume it is on for a reason. All I can say for sure is that the debug log is indicating that log as the reason the insert is rejected. I suspect that if you search harder you might find the record it identified as the duplicate. Or even just try manually inserting the same lead record directly in the Salesforce UI.
– Daniel Ballinger
I just created the Lead with the email in concern and it works absolutely fine from the UI dashboard without any errors whatsoever..Hmm..now then..what could be going wrong :(
– Ali Gajani
Not just the email. It needs to be every field that is being populated. Especially F/L Name, Email, Phone, Address, Title.
– Daniel Ballinger
Alright, it appears that if the phone number is the same, it throws up..that does seem weird to me..shouldn't be happening in a real world but still..how do I disable that
– Ali Gajani
Oh sorry, it's the last name. That is very strange. Many people can have same last names. It shouldn't ever throw up..How do I disable this uniqueness check on LastName entirely?
– Ali Gajani
You either: 1) complete turn off the rule (not recommended without admin approval), 2) Use the DuplicateRuleHeader header on a SOAP request, or 3) manually make your own version of the REST API that allows you to specify the DuplicateRuleHeader on the DML in Apex.
– Daniel Ballinger
Nevermind, I am just being paranoid. The test user entered the same information and it wouldn't ever happen in real world that FN, LN and PHONE are all same so I'll let it pass. Thanks Daniel :)
– Ali Gajani
So to clarify for whoever is reading this answer. The duplicate check of FN AND LN AND PHONE was being triggered hence preventing the lead creation. This doesn't happen ever in the real world so a non-issue.
– Ali Gajani