{"id":717,"date":"2014-07-08T12:11:42","date_gmt":"2014-07-08T06:41:42","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=717"},"modified":"2014-07-08T12:11:42","modified_gmt":"2014-07-08T06:41:42","slug":"duplicate-detection-is-back-in-microsoft-dynamics-crm-spring-release","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2014\/07\/duplicate-detection-is-back-in-microsoft-dynamics-crm-spring-release\/","title":{"rendered":"Duplicate Detection is back in Microsoft Dynamics CRM Spring Release"},"content":{"rendered":"<p style=\"text-align: justify;\">How good were the old days of CRM 2011\u00a0that even at the point of creation of records you were notified on the entity form itself that the particular record is a duplicate record and hence the data duplication was reduced to a considerable amount. But suddenly in CRM 2013 Duplicate Detection was removed partially i.e., it was no more available on the entity form, at the time of new record creation but it was available on the Home Page of all those entities for which duplicate detection was enabled.<\/p>\n<p style=\"text-align: justify;\">In the Spring Release, Duplicate Detection is back with all its old charm plus a new feature that would be further explained in this blog.<\/p>\n<p style=\"text-align: justify;\">Prior to Spring Release Update if you enabled Duplicate Detection for any of the entity the only way to understand that we have duplicate data in our records was to run Duplicate Detection Job for that entity.<\/p>\n<p style=\"text-align: justify;\">Things have now changed \u00a0a bit after the Spring Release update or we can say things have been brought back to normal\u00a0by reinstating\u00a0the same old feature\u00a0of detecting duplicates at the time of Record Creation as well as\u00a0a new feature that detects duplicate records at Auto Save as well. This reduces the extra steps to some extent that were needed prior to Spring Release update in order to have the Duplicate Detection Job work. However,\u00a0the same procedure can be followed post the update\u00a0as well,\u00a0since\u00a0it is an essential part for duplicate detection and cannot be removed.<\/p>\n<p style=\"text-align: justify;\"><span style=\"text-decoration: underline;\"><strong>Duplicate Detection on the entity form<\/strong><\/span><strong>:<\/strong><\/p>\n<p style=\"text-align: justify;\"><strong>1. At the time of creation of the record:<\/strong><\/p>\n<p style=\"text-align: justify;\">For this demo, we have created an Account with the name &#8220;Apollo.&#8221; Now, we are trying to create another Account with same name. So, on the entity form itself we get the Duplicate Detection\u00a0result. You have the option to Save anyway or Cancel.<\/p>\n<p style=\"text-align: justify;\"><em><strong>Note<\/strong>: <\/em><em>Even while creating record using Quick Create Form, you&#8217;ll get the Duplicate Detection result\u00a0there itself.<\/em><\/p>\n<p style=\"text-align: justify;\"><a href=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2014\/07\/img11.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-718\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2014\/07\/img11.jpg\" alt=\"img1\" width=\"624\" height=\"549\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">2.\u00a0 <strong><span style=\"text-decoration: underline;\">Auto Save<\/span>:<\/strong><\/p>\n<p style=\"text-align: justify;\">Consider you have recently upgraded to Spring Release and you already have duplicate records. You are now updating one of the duplicate records and you mostly rely on Auto Save to save the updates. In that case, you&#8217;ll get a notification as shown in the below snapshot:<\/p>\n<p style=\"text-align: justify;\"><a href=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2014\/07\/img21.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-719\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2014\/07\/img21.jpg\" alt=\"img2\" width=\"624\" height=\"36\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">This is indeed a handy feature that saves our time by detecting duplicate records on the spot and sparing us from going the conventional way.<\/p>\n<p style=\"text-align: justify;\">3. <strong><span style=\"text-decoration: underline;\">Qualifying Lead<\/span>:<\/strong><\/p>\n<p style=\"text-align: justify;\">If you try qualifying a Lead record with the Company Name matching with the existing Account record then in that case you`ll get a Duplicate Warning dialog where you can associate the existing company(Account record) with the current Lead record or else you can Continue creating a new Account record with same name.<\/p>\n<p style=\"text-align: justify;\"><a href=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2014\/07\/img31.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-723\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2014\/07\/img31.jpg\" alt=\"img3\" width=\"375\" height=\"283\" \/><\/a><\/p>\n<p style=\"text-align: justify;\"><em><strong>Note<\/strong>:<\/em><em>\u00a0 In the above demo we are detecting duplicates by same Account Name. However, it is not simply restricted to Name, you can create your own rules for other fields for other entities as well.<\/em><\/p>\n<p style=\"text-align: justify;\"><strong><span style=\"text-decoration: underline;\">Verifying Duplicate Detection through programming<\/span>:<\/strong><\/p>\n<p style=\"text-align: justify;\">While creating a record for an entity programmatically, we observe that even if Duplicate Detection is enabled for the entity, it does not work and it still allows to create the duplicate record for the entity.<\/p>\n<p style=\"text-align: justify;\">In order to enable Duplicate Detection we have to enable \u201cSuppressDuplicateDetection\u201d parameter in the CreateRequest while creating the record for the entity programmatically.<\/p>\n<p style=\"text-align: justify;\">The below code shows how to add this parameter and set its value:<\/p>\n<p style=\"text-align: justify;\"><strong><span style=\"text-decoration: underline;\">Code Snippet<\/span>:<\/strong><\/p>\n<p style=\"text-align: justify;\"><span style=\"color: #00ccff;\">Guid<\/span>\u00a0id = Guid.Empty;<br \/>\n<span style=\"color: #3366ff;\">try<\/span><br \/>\n{<br \/>\n<span style=\"color: #339966;\">\/\/Create an instance of Account entity<\/span><br \/>\n<span style=\"color: #00ccff;\">Account<\/span> account = <span style=\"color: #3366ff;\">new<\/span> <span style=\"color: #00ccff;\">Account<\/span>();<\/p>\n<p style=\"text-align: justify;\"><span style=\"color: #339966;\">\/\/set account name as \u201cApollo\u201d in order to check Duplicate Detection<\/span><br \/>\n<span style=\"color: #339966;\">\/\/Considering that a record with the name \u201cApollo\u201d already exists for the Account entity<\/span><br \/>\naccount.Name = &#8220;<span style=\"color: #993300;\">Apollo<\/span>&#8220;;<\/p>\n<p style=\"text-align: justify;\"><span style=\"color: #339966;\">\/\/ Create operation for creating a new account entity<\/span><br \/>\n<span style=\"color: #00ccff;\">CreateRequest<\/span> reqCreate = <span style=\"color: #3366ff;\">new<\/span> <span style=\"color: #00ccff;\">CreateRequest<\/span>();<\/p>\n<p style=\"text-align: justify;\"><span style=\"color: #339966;\">\/\/Setting the Target of the Request to Account<\/span><br \/>\nreqCreate.Target = account;<\/p>\n<p style=\"text-align: justify;\"><span style=\"color: #339966;\">\/\/This parameter will check for duplication if set to false<\/span><br \/>\nreqCreate.Parameters.Add(&#8220;<span style=\"color: #993300;\">SuppressDuplicateDetection<\/span>&#8220;, <span style=\"color: #3366ff;\">false<\/span>);<\/p>\n<p style=\"text-align: justify;\"><span style=\"color: #339966;\">\/\/Create an instance of CreateResponse to execute the \u201cCreate\u201d message<\/span><br \/>\n<span style=\"color: #00ccff;\">CreateResponse<\/span> createResponse = (<span style=\"color: #00ccff;\">CreateResponse<\/span>)service.Execute(reqCreate);<\/p>\n<p style=\"text-align: justify;\"><span style=\"color: #339966;\">\/\/If it is not duplicate then set the newly generated record id to the variable<\/span><br \/>\nid = createResponse.id;<\/p>\n<p style=\"text-align: justify;\">}<br \/>\n<span style=\"color: #3366ff;\">catch<\/span> (<span style=\"color: #00ccff;\">SaveChangesException<\/span> ex)<br \/>\n{<br \/>\n<span style=\"color: #3366ff;\">throw<\/span> ex;<br \/>\n}<br \/>\n<span style=\"color: #3366ff;\">catch<\/span> (<span style=\"color: #00ccff;\">FaultException<\/span>&lt;<span style=\"color: #00ccff;\">OrganizationServiceFault<\/span>&gt; ex)<br \/>\n{<br \/>\n<span style=\"color: #3366ff;\">throw<\/span> ex;<br \/>\n}<\/p>\n<p style=\"text-align: justify;\"><strong><span style=\"text-decoration: underline;\">Note<\/span>:<\/strong><\/p>\n<p style=\"text-align: justify;\">If you create records programmatically using CreateRequest with the parameter SuppressDuplicateDetection as false, then duplicate detection will take place and if the record is a duplicate record then it won`t be created and the below error will be shown:<\/p>\n<p style=\"text-align: justify;\">\u201cA record was not created or updated because a duplicate of the current record already exists.\u201d<\/p>\n<p style=\"text-align: justify;\">As you can see, we need the CreateRequest to enable Dup detection while creating record and therefore this feature is not available when creating records using oData.<\/p>\n<p style=\"text-align: justify;\">Duplicate Detection also works while importing records using the OOB import data functionality.<\/p>\n<p style=\"text-align: justify;\">You can also enable duplicate detection and retrieve duplicates programmatically using the RetrieveDuplicatesRequest. An example for the same can be found on <a title=\"MSDN\" href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/hh547456.aspx\" target=\"_blank\" rel=\"noopener noreferrer\">MSDN<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How good were the old days of CRM 2011\u00a0that even at the point of creation of records you were notified on the entity form itself that the particular record is a duplicate record and hence the data duplication was reduced to a considerable amount. But suddenly in CRM 2013 Duplicate Detection was removed partially i.e.,\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2014\/07\/duplicate-detection-is-back-in-microsoft-dynamics-crm-spring-release\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[21,22,24],"tags":[367,526,740,1107,1416,1648],"class_list":["post-717","post","type-post","status-publish","format-standard","hentry","category-dynamics-crm-2013","category-dynamics-crm-2015","category-dynamics-crm-2016","tag-create","tag-duplicate-detection","tag-entity","tag-microsoft-dynamics-crm-2013","tag-record","tag-spring-release"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/717","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=717"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/717\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=717"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=717"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=717"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}