I have written a small console application having code to create a new lead in CRM 2011.
Lead newLead = new Lead()
{
FirstName="test",
LastName = "test",
EMailAddress1 = "test@test.com",
CompanyName = "ABC1"
};
proxy.Create(newLead);
This generates an error saying "Generic SQL Error".
When I checked the SQL Profiler, it generates 3 error messages related to my application.
1. EventClass = Exception.
Description = Error: 2601, Severity: 14, State: 1
2. EventClass = User Error Message.
Description = Cannot insert duplicate key row in object 'dbo.EmailSearchBase' with unique index 'ndx_for_forward_update'.
3. EventClass = User Error Message.
Description = The statement has been terminated.
I focused on 2nd error message and disabled Lead duplicate detection rules. But still the error occurs. Also I am able to create records from CRM frontend.
If I remove EmailAddress1 field from the code, then lead is created successfully.
Any ideas please
Thanks
Ajay Chawla