{"id":4493,"date":"2023-09-29T12:11:38","date_gmt":"2023-09-29T12:11:38","guid":{"rendered":"https:\/\/himbap.com\/blog\/?p=4493"},"modified":"2023-09-29T14:13:59","modified_gmt":"2023-09-29T14:13:59","slug":"an-attribute-with-the-specified-name-already-exists","status":"publish","type":"post","link":"https:\/\/himbap.com\/blog\/?p=4493","title":{"rendered":"An attribute with the specified name already exists"},"content":{"rendered":"<p style=\"text-align: left;\"><strong>Introduction<\/strong><br \/>\nWe know there are many out of the box fields created when we create a custom entity, but do you know when you create specific data type fields, some hidden fields are created using the field name. Today we are going to discuss that.<\/p>\n<p><strong>Details<\/strong><br \/>\nLet say we need to create two fields first one &#8220;Location&#8221; in my entity and that is lookup, which is pointing to another custom entity called &#8220;Location&#8221;. Second field we need to create called &#8220;Location Name&#8221; of single line of text. When we will try to create second field after creating Location field we will get following error<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2023\/09\/do-you-know1.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-4494 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2023\/09\/do-you-know1-300x97.jpg\" alt=\"do you know1\" width=\"300\" height=\"97\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2023\/09\/do-you-know1-300x97.jpg 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2023\/09\/do-you-know1-1024x330.jpg 1024w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2023\/09\/do-you-know1-624x201.jpg 624w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2023\/09\/do-you-know1.jpg 1187w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>This could be confusing as we don&#8217;t any field with this name in our entity :). Actually when we create specific type of fields, D365 created some hidden field automatically. One way to see hidden field is create a SSRS report and get all attributes for your entity for example I am getting account fields.<\/p>\n<p>&lt;fetch version=&quot;1.0&quot; output-format=&quot;xml-platform&quot; mapping=&quot;logical&quot; distinct=&quot;false&quot;&gt;<br \/>\n  &lt;entity name=&quot;account&quot;&gt;<br \/>\n &lt;all-attributes \/&gt;<br \/>\n&lt;\/entity&gt;&lt;\/fetch&gt;<\/p>\n<p><a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2023\/09\/Doyouknow2.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-4495 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2023\/09\/Doyouknow2-300x298.png\" alt=\"Doyouknow2\" width=\"300\" height=\"298\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2023\/09\/Doyouknow2-300x298.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2023\/09\/Doyouknow2-150x150.png 150w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2023\/09\/Doyouknow2-176x176.png 176w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2023\/09\/Doyouknow2.png 612w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>In above screenshot I have highlighted some of the field which are created automatically. Now if you really want to create field, you need to use some other logical name for your field (manually change logical name field while creating field) and you can keep display name as we want like below<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2023\/09\/document4.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-4496 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2023\/09\/document4-231x300.png\" alt=\"document4\" width=\"231\" height=\"300\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2023\/09\/document4-231x300.png 231w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2023\/09\/document4-624x812.png 624w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2023\/09\/document4.png 648w\" sizes=\"(max-width: 231px) 100vw, 231px\" \/><\/a><\/p>\n<p><strong>Summary<\/strong>:<br \/>\nSo we know now there some hidden field created for some of the datatype fields.<\/p>\n<p>Hope it will help someone !!<br \/>\n<strong>Keep learning and Keep Sharing !!<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction We know there are many out of the box fields created when we create a custom entity, but do you know when you create specific data type fields, some hidden fields are created using the field name. Today we are going to discuss that. Details Let say we need to create two fields first one &#8220;Location&#8221; in my entity&#8230; <a href=\"https:\/\/himbap.com\/blog\/?p=4493\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":4364,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,6,8,275,10],"tags":[1045,1046,1047],"_links":{"self":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4493"}],"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=4493"}],"version-history":[{"count":3,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4493\/revisions"}],"predecessor-version":[{"id":4499,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4493\/revisions\/4499"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/media\/4364"}],"wp:attachment":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}