I have a bunch of fields on an object that I need to display based on the objects picklist field called category type. Unfortunately there are lot of fields and lot of category type and also I can't use record type because I am using lightning component as I decide whether are not to display these fields based on the current user role. Rather than using if else statements I was thinking of creating a custom object with text area large fields for each category type and filling them with the fields API name. There will be only one record and I query the record based on the category type. Cast it to string and split it into list of strings and return it to the client side controller, passing it to the lightning component. It works but I want to know is there any drawback of doing it like this? Sure tomorrow if the customer says I want more fields for a category, I need to modify the record or adds new category with almost identical fields of already existing category with some changes, I need to create new category field on this custom object and update the single record. But are there other drawbacks like are there limits on how many large text area fields I can create etc.?
The platform-native functionality that is generally preferred for storing named lists of fields and consuming them elsewhere on the platform is Field Sets.
The nice thing about Field Sets is that they come with a built-in user interface for maintenance, and their content is very easy to access through the Describe API.