function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
OTOT 

Describe Object field lengths not accurate

Hi there,

I've used the describe object on the Contact object to return all field names, field types and lengths.

For some reason, a custom field that is "Text" and has a field length of 15 accepts entries much longer than that.

When I log into SF.com, I see the contact record with the full, text entry, when I select edit, then the value is truncated to the first 15 characters. So this tells me that the 15 character length is not the true storage size of this field.

What value can I use to get the true length of the field?

Regards,

OT

benjasikbenjasik
The system will take a longer value, but truncate at the length. So if you pass up 20, and the limit is 15, we'll truncate to 15.

You should use the describeSObject result to determine the field length.
OTOT

Hi,

I am using the Describe object (original thread and subject). It tells me it's 15 characters.

Is there another Describe object that I'm not aware of?

OT

 

benjasikbenjasik
That's it.

Was it defined as 15-characters long when the custom field was created?
OTOT

Hi Benji,

Yes, it was. The field definition in Salesforce is: Text(15).

and using the Desribe API, it also indicates it is 15 characters in length.

OT

OTOT

Hi Benji,

Do you have any updates on this issue?

 

OT

benjasikbenjasik
I just did this:

Created a test custom field on account, length 3

Used the API to insert a value 6 characters long.

Looked in the UI, value was three characters long

Queried in the API, value was three characters long