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
bakul.patelbakul.patel 

Duplicate Lead Created

Hi,
I have created a REST service and exposed it through a site to allow creation of lead when form is submitted. REST end point is .../service/apexrest/WebToLeadService
Due to few complexities we can't use web to lead form.

The REST serivce is working fine as such, but I am noticing a strange behavior.
After a lead is created, one more duplicate lead is created automatically. This duplicate's name is Organization name.

Does anybody have idea why Salesforce would create a duplicate lead on its own?

Thanks
Bakul
John Pipkin 14John Pipkin 14
Bakul, 

There couple be a number of reasons why dupes are being created.

Is the form submit button being clicked twice? If so, you can write JS function to disable the button one the first click. 
Are you using multiple upsert calls?
Is there any other automation going on in triggers, workflows, processes that could do this?

Try turning on the debug log when you submit the form and see where the extra lead is coming from.

Without knowing more information, it is hard to give any more details. Hope that helps.
John Pipkin 14John Pipkin 14
Also, you can check out this stackexchange thread: http://salesforce.stackexchange.com/questions/14871/upsert-using-rest-api-creates-duplicate-records