I am passing dynamic values to the getValues() method so I didn't have control of what is being entered, whenever name string crosses 38 characters its giving "Custom Setting Name too long" error.

So, is it possible to increase the length of Custom setting Name field?

2 Answers 2


That is the limit for the custom setting name. Please, take a look to this article where it explains this limitation:

Define Custom Settings

enter image description here

Looking around I found that there is a 'workaround' that it may help you. Check it here


When using the getValues() function to retrieve a specific custom setting by its name, an error may occur if the name exceeds the allowed length.

When creating custom settings, the name can be up to 38 characters long also.

To prevent this error, you can add a sanity check to your code to ensure the name parameter does not exceed 38 characters, as shown below:

String recivedLS = 'Marketing AU 101'; // name of the setting record
if(recivedLS.length() < 38){
    // Searched settings  available
    Lead_Source_Settings__c sett = Lead_Source_Settings__c.getValues(recivedLS);
}else {
    // Searched settings not available
  • 2
    This doesn't answer the question (which was "can I increase the length of this field?"). It doesn't even offer a good workaround. Also, if this answer was generated by chatGPT or another similar A.I. tool, know that we do not allow that here.
    – Derek F
    Commented Jun 26 at 11:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .