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.

Since job descriptions can be lengthy, let's choose a long text area.

  1. Choose the Text Area (Long) data type, and click Next.
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.

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 TypeField LabelLength# Visible LinesDefault Value
Text Area (Long)Responsibilities32,7683Leave unspecified
Text Area (Long)Skills Required32,7683Leave unspecified
Text Area (Long)Educational Requirements32,7683Leave 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.

© Copyright 2000–2015, inc. All rights reserved.
Various trademarks held by their respective owners.