{"id":2917,"date":"2018-01-23T09:08:53","date_gmt":"2018-01-23T09:08:53","guid":{"rendered":"http:\/\/himbap.com\/blog\/?p=2917"},"modified":"2018-01-23T09:10:13","modified_gmt":"2018-01-23T09:10:13","slug":"implementing-duplicate-detection-using-keys","status":"publish","type":"post","link":"https:\/\/himbap.com\/blog\/?p=2917","title":{"rendered":"Implementing Duplicate Detection using Keys"},"content":{"rendered":"<p>Dynamics CRM contains duplicate detection feature, if want to know about this feature you can <a href=\"https:\/\/msdn.microsoft.com\/en-au\/library\/gg309427.aspx\">check here<\/a>. This feature can be enabled for\u00a0multiple operations\u00a0for example, we can see different options under duplicate detection settings below:<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2018\/01\/duplicatedet1.png\"><img decoding=\"async\" loading=\"lazy\" class=\" size-medium wp-image-2918 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2018\/01\/duplicatedet1-300x177.png\" alt=\"duplicatedet1\" width=\"300\" height=\"177\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2018\/01\/duplicatedet1-300x177.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2018\/01\/duplicatedet1.png 581w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>These setting work differently based on operations for example if\u00a0user will try to import data to respective entity for which you have duplication detection rule published. During data import\u00a0user will get dialog where\u00a0it will ask you for Allow Duplicates record like below:<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2018\/01\/duplicatedet2.png\"><img decoding=\"async\" loading=\"lazy\" class=\" size-medium wp-image-2919 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2018\/01\/duplicatedet2-300x130.png\" alt=\"duplicatedet2\" width=\"300\" height=\"130\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2018\/01\/duplicatedet2-300x130.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2018\/01\/duplicatedet2.png 585w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>So if user will say No, it won\u2019t create any duplicate record whereas if user will try to create duplicate record manually in CRM it will show user a dialog but still user can click on save and it will create duplicate record. For example let&#8217;s say we have a duplicate detection rule published for account entity to check for duplicate based on email, if user will try to create account record with the same email id again it will show user a dialog with potential duplicate record but if user will click on Save it will allow you to save duplicate record.<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2018\/01\/duplicate9.png\"><img decoding=\"async\" loading=\"lazy\" class=\" size-medium wp-image-2920 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2018\/01\/duplicate9-300x254.png\" alt=\"duplicate9\" width=\"300\" height=\"254\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2018\/01\/duplicate9-300x254.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2018\/01\/duplicate9-624x528.png 624w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2018\/01\/duplicate9.png 658w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>To stop creating duplicate we can simply use Keys to implement duplicate detection without any code. Let\u2019s see how:<br \/>\n1. Go to Settings-&gt; Customizations-&gt; Customize the System<br \/>\n2. Expend Entities node and look for Account entity<br \/>\n3. Select Keys and click on New from right hand side<br \/>\n4. Select Email field under Available Attributes and click on Add button<br \/>\n5. Write Email under Display Name and click on Save.<\/p>\n<p>Publish account entity and now when user will try to create account record again using email id which is used for existing account, user will get following error and it won&#8217;t let user to create duplicate record:<\/p>\n<p><a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2018\/01\/duplicate10.png\"><img decoding=\"async\" loading=\"lazy\" class=\" size-medium wp-image-2921 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2018\/01\/duplicate10-300x141.png\" alt=\"duplicate10\" width=\"300\" height=\"141\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2018\/01\/duplicate10-300x141.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2018\/01\/duplicate10.png 503w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>You can check our earlier article for how to <a href=\"https:\/\/himbap.com\/blog\/?p=1522\">use Keys for upsert<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Dynamics CRM contains duplicate detection feature, if want to know about this feature you can check here. This feature can be enabled for\u00a0multiple operations\u00a0for example, we can see different options under duplicate detection settings below: These setting work differently based on operations for example if\u00a0user will try to import data to respective entity for which you have duplication detection rule&#8230; <a href=\"https:\/\/himbap.com\/blog\/?p=2917\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":2921,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[402,8],"tags":[497,498,499],"_links":{"self":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2917"}],"collection":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2917"}],"version-history":[{"count":7,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2917\/revisions"}],"predecessor-version":[{"id":2928,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2917\/revisions\/2928"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/media\/2921"}],"wp:attachment":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2917"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2917"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2917"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}