Using Category To Store Your Master Data

In every CRM implementation, we deal with some sort of master data in CRM. Normally, we use traditional ways to store master records by creating custom entities. But we do have a better way to store master data, i.e., using  Category entity. This entity was introduced in CRM 2016. This is very helpful in implementing hierarchical structure. In this article, we are going to use Category entity to store the state and city master data for demo purpose.

Let's say we are developing an Event Management solution and we have a 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 Settings -> Service Management ->Categories.

You can find more details about Category here.

Let’s first setup Parent Category and name it as State, we will be using it for setting default view for state and city lookup later. 
Once parent category is setup we can create child records manually or import child records by downloading data import template for category under Data Management->Templates for Data Import.

Similarly we can import the list of the city with corresponding state (By setting State as Parent Category) using the same data import template.
Now we need to create two views 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 the following filter criteria,


Similarly create a new view for City using the following filter criteria,


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.


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 the following,


 While setting for city lookup, we need to also set Related Record filtering to show only  thecity related to selected State.