8

There is a Name field of type Name in Contact object. It consists of FirstName and LastName. I can query those two fields using Apex.

Even though I cannot find any proofs in Object Manager of that, I am sure that FirstName and LastName have Text type.

Now I would like to know how many characters they accept (i.e. if their type is Text(n) I would like to know what value does n have). I tried to use Object Manager to find that out, but there seems to be no info about this. And also, when I go to edition of Name field it tells you nothing useful on FirstName and LastName fields.

So, what is the length of FirstName and LastName fields?

Thank you.

enter image description here

enter image description here

2 Answers 2

8

A quicker way to do that is to use describe call in Apex.

System.debug(Contact.FirstName.getDescribe().length); //Prints 40
System.debug(Contact.LastName.getDescribe().length); //Prints 80

It also works for All fields standard and custom.

That being said, you can use global describe to get lengths of all fields.

Src : https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dynamic_describe_objects_understanding.htm

6

you can check details about fields on Contact SOAP API guide

FirstName - The contact’s first name up to 40 characters.

LastName - Required. Last name of the contact up to 80 characters.

You must log in to answer this question.

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