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.
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 Settings -> Service Management ->Categories.
You can refer 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 list of the city with corresponding state (By setting State as Parent Category) using same data import template.
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:
Similarly create a new view for City using 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 following:
While setting for city lookup, we need to also set Related Record filtering to show only city related to selected State.
Finally save and publish our changes. Now when we will select state lookup we will be only able to see states like following:
once state is selected, it will show corresponding cities under city lookup. Similarly we can use category entity to implement more scenarios.