0

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.?

3
  • 3
    Have you considered using Field Sets? – David Reed Jul 14 '20 at 22:44
  • @DavidReed you sir are a life saver. – nSv23 Jul 16 '20 at 12:51
  • I will add this as an answer. – David Reed Jul 16 '20 at 15:36
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.