{"id":2740,"date":"2017-07-31T17:07:54","date_gmt":"2017-07-31T17:07:54","guid":{"rendered":"http:\/\/himbap.com\/blog\/?p=2740"},"modified":"2017-07-31T17:07:54","modified_gmt":"2017-07-31T17:07:54","slug":"using-category-to-store-your-master-data","status":"publish","type":"post","link":"https:\/\/himbap.com\/blog\/?p=2740","title":{"rendered":"Using Category to store your Master Data"},"content":{"rendered":"<p>In every CRM implementation, we deal with some sort of master data in CRM. Normally we use traditional way to store master records by creating custom entities. But we do have better way to store master data using Category entity. This entity was introduced in CRM 2016. This entity is very helpful to implement hierarchical structure. In this article we are going to use category entity to store state and city master data for demo purpose.<\/p>\n<p>Let say we are developing an event management solution and we have requirement to show state and city information in our event entity (We can use similar way in any other entity). We will be using category to store these details. To use category entity we can navigate to <strong>Settings -&gt; Service Management -&gt;Categories<\/strong>.<br \/>\nYou can refer more details about category <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/mt728945.aspx?f=255&amp;MSPPError=-2147217396\">here<\/a>.<\/p>\n<p>Let\u2019s first setup Parent Category and name it as State, we will be using it for setting default view for state and city lookup later.<\/p>\n<p><a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category1.png\"><img decoding=\"async\" loading=\"lazy\" class=\" size-medium wp-image-2741 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category1-300x223.png\" alt=\"category1\" width=\"300\" height=\"223\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category1-300x223.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category1.png 419w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Once parent category is setup we can create child records manually or import child records by downloading data import template for category under <strong>Data Management-&gt;Templates<\/strong> for Data Import.<\/p>\n<p><a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/categorystate2.png\"><img decoding=\"async\" loading=\"lazy\" class=\" size-medium wp-image-2749 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/categorystate2-300x237.png\" alt=\"categorystate2\" width=\"300\" height=\"237\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/categorystate2-300x237.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/categorystate2.png 541w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Similarly we can import list of the city with corresponding state (By setting State as Parent Category) using same data import template.<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/categorycity3.png\"><img decoding=\"async\" loading=\"lazy\" class=\" size-medium wp-image-2748 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/categorycity3-300x286.png\" alt=\"categorycity3\" width=\"300\" height=\"286\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/categorycity3-300x286.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/categorycity3.png 500w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Now we need to create two view to show only State and City category in respective lookups (we may have some other master data stored in category entity). Navigate to default solution and create new view for Category entity using following filter criteria:<\/p>\n<p><a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category4.png\"><img decoding=\"async\" loading=\"lazy\" class=\" size-medium wp-image-2743 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category4-300x141.png\" alt=\"category4\" width=\"300\" height=\"141\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category4-300x141.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category4.png 531w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Similarly create a new view for City using following filter criteria:<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category5.png\"><img decoding=\"async\" loading=\"lazy\" class=\" size-medium wp-image-2744 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category5-300x146.png\" alt=\"category5\" width=\"300\" height=\"146\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category5-300x146.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category5.png 522w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Now we need to create lookup for State and City in our event entity, navigate to event entity and create two lookup fields for state and city by selecting Target Record Type as Category.<\/p>\n<p><a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category6.png\"><img decoding=\"async\" loading=\"lazy\" class=\" size-medium wp-image-2745 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category6-300x53.png\" alt=\"category6\" width=\"300\" height=\"53\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category6-300x53.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category6.png 383w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>We need to place these fields on the form and need to set following lookup fields property to show specific views that we have created earlier like following:<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category7.png\"><img decoding=\"async\" loading=\"lazy\" class=\" size-medium wp-image-2746 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category7-300x110.png\" alt=\"category7\" width=\"300\" height=\"110\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category7-300x110.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category7.png 492w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>While setting for city lookup, we need to also set Related Record filtering to show only city related to selected State.<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category8.png\"><img decoding=\"async\" loading=\"lazy\" class=\" size-medium wp-image-2747 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category8-300x208.png\" alt=\"category8\" width=\"300\" height=\"208\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category8-300x208.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category8.png 491w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Finally save and publish our changes. Now when we will select state lookup we will be only able to see states like following:<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category9.png\"><img decoding=\"async\" loading=\"lazy\" class=\" size-medium wp-image-2751 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category9-300x164.png\" alt=\"category9\" width=\"300\" height=\"164\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category9-300x164.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2017\/07\/category9.png 382w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>once state is selected, it will show corresponding cities under city lookup. Similarly we can use category entity to implement more scenarios.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In every CRM implementation, we deal with some sort of master data in CRM. Normally we use traditional way to store master records by creating custom entities. But we do have better way to store master data using Category entity. This entity was introduced in CRM 2016. This entity is very helpful to implement hierarchical structure. In this article we&#8230; <a href=\"https:\/\/himbap.com\/blog\/?p=2740\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[402,275],"tags":[450,449,451],"_links":{"self":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2740"}],"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=2740"}],"version-history":[{"count":3,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2740\/revisions"}],"predecessor-version":[{"id":2753,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2740\/revisions\/2753"}],"wp:attachment":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2740"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2740"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2740"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}