Newer Version Available
Try It Out: Add Text Fields
First let's define a few text fields. We already created a basic text field for Position Title when we defined our Position custom object. Looking at our screenshot, the only text fields that remain are the text fields under the Description heading. We'll start by defining the Job Description field.
- From Setup, enter Objects in the Quick Find box, then select Objects.
- Click Position.
- In the Custom Fields & Relationships related list, click New.
Every time you create a custom field, you'll first choose a data type from the field type selection page.
- Basic text fields allow users to enter any combination of letters and numbers on a single line, up to as many as 255 characters.
- Text area fields also have a 255-character limit but also allow carriage returns so the text can be formatted on separate lines.
- Long text fields allow as many as 131,072 characters, on separate lines.
- Rich text fields allow user to enter as many as 131,072 characters of formatted text, including images and hyperlinks.
- Encrypted text fields allow users to enter any combination of letters and numbers that are stored in encrypted form, up to as many as 175 characters.
Since job descriptions can be lengthy, let's choose a long text area.
- Choose the Text Area (Long) data type, and click Next.
The second page of the custom field wizard allows us to enter details about our long text area field. The fields that appear in this step change depending on the data type that we selected in the previous page.
- In the Field Label field, enter Job Description.
Like the other labels we've seen in the platform so far, Field Label specifies the text that appears when the field is rendered in the user interface. Notice that when we enter a value for Field Label, Field Name is automatically populated with the same text but with all spaces and punctuation replaced by underscores. The value for Field Name is a unique name that is used to refer to the field when writing a custom formula or using the API.
The Length field allows us to restrict the maximum number of characters that are allowed. Since we don't get any benefit from this kind of restriction, leave this value set to 131,072.
- In the Length field, enter 131,072.
- In the # Visible Lines field, enter 3.
This field allows us to specify how large our text box will appear on the page.
- In the Description and Help Text fields, enter High-level description of the job and its duties.
While the description is displayed only in the details for this custom field in Setup, this help text is displayed on record detail and edit pages when users hover over the field's label. Its purpose is to assist users in filling out the field correctly. It's optional to add help text for a field, but it's a good idea if you have fields that you think might confuse users.
There's no obvious default value for a text field, so just leave Default Value blank.
- Click Next.
The third page of the Custom Field wizard allows us to restrict access to this field from certain user profiles. We'll learn more about profiles and field-level security in Securing and Sharing Data, so for now, just accept the defaults.
- Click Next.
The last page of the wizard allows us to automatically place our field on the Position page layout. Again, we'll learn about page layouts in the next chapter, so for now, just accept the defaults.
- Click Save & New.
| Data Type | Field Label | Length | # Visible Lines | Default Value |
|---|---|---|---|---|
| Text Area (Long) | Responsibilities | 131,072 | 3 | Leave unspecified |
| Text Area (Long) | Skills Required | 131,072 | 3 | Leave unspecified |
| Text Area (Long) | Educational Requirements | 131,072 | 3 | Leave unspecified |
Now that we've wet our feet with text fields, let's quickly create a few more fields of other types. You'll find that with few exceptions, they're all very similar to one another.