Loading

"Error: Custom Setting Name too long" error in Custom Settings Name field when Double-byte characters are used

Udgivelsesdato: Oct 8, 2026
Beskrivelse

When a Salesforce admin or developer enters a double-byte text string in the Custom Settings Name field, the "Error: Custom Setting Name too long" error can still appear even when the string is much shorter than 38 characters.

Custom Settings is a Salesforce feature that allows administrators to create custom data sets and associate them with an organization, profile, or user. Double-byte characters are characters used in languages such as Chinese, Japanese, and Korean, where each character requires two bytes of storage rather than the single byte used by standard ASCII characters.

This error typically appears when a Custom Setting is created with a name that uses double-byte characters and visually appears well under the 38-character limit. The unexpected behavior occurs because Salesforce internally converts the double-byte string into ASCII format using the Java toASCII() method before applying the limit. That conversion can cause the string length to increase non-linearly, meaning a short-looking input can exceed 38 characters after conversion.

Løsning

This article answers the question: why does the "Error: Custom Setting Name too long" error appear in the Salesforce Custom Settings Name field when a double-byte name looks shorter than 38 characters, and how do you avoid it? When double-byte characters such as Chinese or Japanese are used in the Custom Settings Name field, Salesforce converts the string to ASCII using the Java toASCII() method before applying the 38-character limit. Because this conversion can increase string length non-linearly, even short double-byte strings may exceed the limit.

How to Avoid the Custom Setting Name Too Long Error

If double-byte text is used in the Custom Settings Name field, consider making the text string shorter.

Why the Character Limit Applies to the Converted ASCII String

As stated in Define Custom Settings: "The name can't exceed 38 ASCII characters. If you use double byte, there are additional limits on the number of characters allowed."

When double-byte characters are used, the string is converted into ASCII characters by using the Java method toASCII(). The 38-character limit is then applied to the converted ASCII string. As the converted string's length can increase non-linearly, a relatively short input string could be converted to a string longer than 38 characters.

How to Check the Converted Length of a Double-Byte String with Java

It is recommended to check a given string's converted length by using Java. The following example prints the converted ASCII length of two Chinese strings. The first is within the limit, and the second exceeds the limit.

//Within limit
System.out.println(java.net.IDN.toASCII("一二三四五六七八九十壹贰三").length());
//Exceeding limit
System.out.println(java.net.IDN.toASCII("一二三四五六七八九十壹贰三四").length());

Online Java compiler tools, such as tutorialspoint.com, can be used to run this code.

Vidensartikelnummer

000397067

 
Indlæser
Salesforce Help | Article