I would like to develop 'Duplicate Detection' functionality by using PlugIns. For ex. When I create a lead/account/contact/...., the E-Mail in the record will check all the E-Mails for that entity in database. If duplicate is found it will prompt a message. I want code for this functionality. Any good articles regarding PlugIns, plz suggest.
Its a complex functionality to program as you need to take care of current user security privilages to access possible dup records. Also you can use current dup detection model. In your pugin when creating records you can restrict dup records. You can force the creation of a matchcode at the time of record create/update by including the PersistInSyncOptionalParameter in the Create/Update request and setting its value to ‘True’. A code snippet that includes the optional parameter in a CreateRequest is as follows:
CreateRequest request = new CreateRequest(); request.OptionalParameters = new OptionalParameter[] { new PersistInSyncOptionalParameter (true) };
Also go though the following article for a complete working code: