What is the alternative to the Salesforce custom label?

354    Asked by darsh_6738 in Salesforce , Asked on May 8, 2023

We have a custom label whose length is about to reach 1000 characters, and we are using that custom label in APEX. Is there an alternative available to this problem so that custom labels can be replaced with something else and available in APEX too?

Background:

We need to use custom labels to give control to admin and also on different env the label value is different. So if I use that at the code level then it is not controllable . Label contains record type ids with | separation and then we use it in APEX to perform the desired action.

Answered by Clare Matthews

Salesforce custom labels exist to allow text to be presented in different locales for multilingual orgs.


You should never use labels to hold per-org configuration. Instead you should use Custom Metadata Types or Custom Settings to hold this configuration. The benefit of Custom Metadata Types is that you can include the instances in Change Sets and these instances are automatically copied along with other metadata to Sandboxes, unlike Custom Settings which are treated as data (so only appear on partial or full Sandboxes when creating or refreshing them).



Your Answer

Interviews

Parent Categories