contents
Documentation Version
Summer '15 (API version 34.0)
Language
English
  • Winter '16 Preview (API version 35.0) 35.0
  • Summer '15 (API version 34.0) 34.0
  • Spring '15 (API version 33.0) 33.0
  • Winter '15 (API version 32.0) 32.0
  • Summer '14 (API version 31.0) 31.0
  • Spring '14 (API version 30.0) 30.0
  • Winter '14 (API version 29.0) 29.0
  • English

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.

  1. From Setup, click Create | Objects.
  2. Click Position.
  3. 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.

The platform allows us to choose between different types of text fields.
  • 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 32,768 characters, on separate lines.
  • Rich text fields allow user to enter as many as 32,768 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.

  1. Choose the Text Area (Long) data type, and click Next.
Tip

Tip

Carefully consider the data type you choose for each of your custom fields, because once you set it, it isn't always the best idea to change it later. See “Notes on Changing Custom Field Types” in the Salesforce Help for details.

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.

  1. 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.

Note

Note

Within the platform, Field Name is actually stored with __c appended to the end as a suffix (for example, Job_Description__c). This identifies it as a custom field.

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 32,768.

  1. In the Length field, enter 32,768.
  2. In the # Visible Lines field, enter 3.

This field allows us to specify how large our text box will appear on the page.

  1. 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.

  1. 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.

  1. 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.

  1. Click Save & New.
Instead of clicking Save and returning to the Position object detail page, clicking Save & New saves a few clicks and allows us to finish up the other text area fields that we need. Here's what you need to know to define them.
Table 1. Position Object Long Text Area Fields
Data Type Field Label Length # Visible Lines Default Value
Text Area (Long) Responsibilities 32,768 3 Leave unspecified
Text Area (Long) Skills Required 32,768 3 Leave unspecified
Text Area (Long) Educational Requirements 32,768 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.