Duplicate detection in CRM 4.0 is a nice tooling for frontend-users and works like a charm, but what if you want to do this in code? The MSDN API is not telling me enough and google search isn’t much of a help at all.

Therefore I posted some code which shows creation of a contact-record with duplicate detection :

contact eenContact = new contact();
eenContact.firstname = "Bert-Jan";
eenContact.lastname = "Diedering";
eenContact.address1_city = "Utrecht";

TargetCreateContact target = new TargetCreateContact();
target.Contact = eenContact;

CreateRequest request = new CreateRequest();
request.Target = target;
request.OptionalParameters = new OptionalParameter[]
{
new CreateDuplicatesOptionalParameter {Value = false}
};

CreateResponse response = (CreateResponse)client.Execute(request);

Also read a few words about the OptionalParameter.

  • Share/Bookmark
Leave a Reply