Learning Objectives

After completing this unit, you’ll be able to:
  • Create and edit custom objects.
  • Describe typical use cases for custom fields.
  • Create and edit custom fields.
  • Modify the page layout for custom objects.
  • Create a help page for a custom object.

Overview of Custom Objects and Fields

Custom objects and fields let you tailor which data is stored to fit your organization’s needs. Though the Force.com database provides several standard objects, you can easily customize how you track and report on your data.

Custom objects give you the flexibility to store any type of enterprise data that’s relevant to your app, by creating new objects. For example, if you’re building a recruiting app, you can create custom objects called Position and Candidate to track information on job openings and candidates, respectively.

Categorize and track your data even more granularly by using custom fields. Like standard objects, custom objects have fields that define the data for those object records. By default custom objects include several standard fields, including Name, Created By, Last Modified, and Owner.

Custom Objects Already Have Standard Fields Standard fields on a custom object

You can add custom fields to standard or custom objects based on the type of data you want to store.

Let’s say you want your recruiting app to sort candidates by how well they’d fit a position. Create a field named Prospect Rating on the Candidate object and use picklist values to indicate how closely a candidate fits a job description. We’ll do this in the next section.

To associate your custom object with other objects, you can create custom relationship fields. For more about object relationships, check out the Creating Object Relationships unit.

After you define a custom object, you can also:

  • Create a custom tab for the custom object, to display the object’s data
  • Build page layouts to control which fields users can view and edit when entering data for the custom object record
  • Import custom object records
  • Create reports and dashboards to analyze custom object data
  • View, add, or remove the object’s field history, relationships, Chatter feed tracking, custom links, search layouts, and object limits
  • Associate the custom object with other records and display the custom object data in custom related lists
  • Track tasks and events for custom object records

Create a Custom Object

Let’s use our earlier example of a recruiting app to practice creating custom objects. We want a new object named Candidate to keep track of job applicants for each position. (We won’t use an existing object like Contact, because our existing objects are already being used for specific purposes.)

  1. From Setup, enter Objects in the Quick Find box, then select Objects under Create.
  2. Click New Custom Object.
  3. Enter the Label, Plural Label, Object Name, and Description as shown. The object’s labels appear in the user interface, while the Object Name is used in the API.
    Define the Candidate Object Create a custom object named Candidate
  4. Under Object Creation Options, select Launch New Custom Tab Wizard, so you can set up a new tab for Candidates.
  5. Click Save.
  6. On the New Custom Object Tab page, select the People style for Tab Style.
  7. Keep the defaults for the rest of the Tab Wizard, and click Save.

Create a Custom Picklist Field for the Candidate Object

Watch a demo video of creating a custom field.

Now that we have a Candidate object, we can customize it to categorize candidates by how well they fit particular positions. For example, we want reports to show all the “Hot” candidates at the top, so recruiters can contact those applicants first.

So we’ll create a custom field named Prospect Rating, make it a picklist field, and give it several values to classify candidates. We conveniently create the custom field directly on the Candidate object, so it’s already associated only with that object.

Let’s locate the Candidate object and create the new field.

  1. From Setup, click Create | Objects and click the object’s name.
  2. In Custom Fields & Relationships, click New.
  3. Select Picklist and click Next. In this case we don’t need a multi-select picklist, because users should select only one value for the candidate’s Prospect Rating.
  4. Enter the Field Label, picklist values, Field Name, Description, and Help Text as shown.Definition of the custom field Prospect Rating


    Adding help text gives your users a better idea of how to use a field, and can mean more accurate data for your organization.

  5. Click Next.
  6. For this field we won’t worry about field-level security. By default all user profiles can see the Prospect Rating field, which is what we want.
  7. Click Next again.
  8. Keep the default page layout selection. The field is added to the Candidate object’s page layout, because we created the field on that object.
  9. Click Save.

Create a Help Page for the Candidate Object

We highly recommend that you create help pages for your custom objects. It's easy to provide useful information about your object by using a simple Visualforce page. Your users will thank you!

Let’s create a simple Visualforce help page to reference from your Candidate object.

  1. From Setup, enter Pages in the Quick Find box, then select Visualforce Pages.
  2. Click New.
  3. Enter a label for your page — for example, Job Candidate Help.
  4. Enter a unique name for the page — for example, Job_Candidate_Help.
  5. In the Visualforce Markup area, enter information about your custom object. You might want to include dependencies, next steps, or other tips for using the object.
    For example:
    <h1>Help for the Candidate Object</h1>
        <p>The Candidate object is for identifying and tracking individual candidates for job positions.</p>
        <p>Sort candidates by Name, Location, Last Modified, and Prospect Rating.</p>
  6. Now let’s reference the help page you just created from your Candidate object. To do this, we’ll edit the Candidate object.
    1. In the Setup Quick Find box, type Object.
    2. Under Create, click Objects.
    3. Click Edit next to the Candidate object’s name.
    4. Select Open a window using a Visualforce page and choose the page you created.
      Custom object help display setting
    5. Click Save.
When your users click the Help for this Page link on a candidate record, they’ll see the helpful information that you provided about the Candidate object.

Edit the Picklist Field

After your users start tracking Candidates, they decide to sort candidates a little more granularly. The hiring managers request an additional picklist value, to easily see who’s a top candidate for a job.

To add a value to the picklist, you modify the Prospect Rating field.



Editing fields can involve changing a large number of records at once. If this process takes a long time, it might be queued. You’ll get an email when the process is complete.

  1. In the Setup Quick Find box, type Object.
  2. Under Create, click Object.
  3. Click the Candidate object’s name.
  4. Under Custom Fields & Relationships, click the Prospect Rating field name.
    Add a value to the Prospect Rating picklist
  5. In the Picklist Values section, click New.
  6. Type Manager Favorite in the text box.
  7. Click Save.

Best Practices for Custom Objects and Fields

Custom objects and fields shape your data! Here are a few tips for creating custom objects that enhance instead of clutter your organization’s records and reports.

  • Unique naming: Make object and field names and labels concise, specific, and descriptive. And very importantly, unique. For example, if your recruiting app’s Position object has a field named Skill Set, use something like Candidate Skill Set on the Candidate object to describe applicants’ skills.
  • Thoughtful architecture: When adding fields to an object, what’s the cleanest and most efficient way to capture data? For example, instead of a long list of checkboxes to track the regions that currently have a particular position open, use a picklist.
  • Default field values: Don’t assign default values to fields that are both required and unique, as this can cause uniqueness errors.
  • Careful renaming: If you’ve renamed objects or fields, check that these items reflect the new names:
    • List view names
    • Standard report names or descriptions that include the objects or fields
    • Email templates that contain the object or field names
    • Any other items you customized along with the renamed object or field — custom fields, page layout, or record types
  • Global data updates: Before changing a field type (for example from checkbox to picklist), make sure the change makes sense for all records that have that field.
  • Help for users: Add help text when defining new objects or fields. Help text should describe exactly what the object or field is for.

Tell Me More ...

Page layouts define which fields users can view and edit when entering data for a custom object record.

When you create a custom object it comes with a default page layout. Tailor which data users enter for that object’s records by building your own page layout with related lists and custom links. For details, see Building Page Layouts for Custom Objects.

When you create a custom field on an object, the New Custom Field wizard guides you through defining the type of field you choose. For example for a formula field you’re prompted to select the type of calculation and to define the fields, operators, and functions in your formula. Or for a percent field, specify the number of decimal places.



If you don’t use any page layout with your custom object, you can still interact with it by using the Force.com API to manage custom data or build a custom user interface.




Remember, this module is meant for Salesforce Classic. When you launch your hands-on org, switch to Salesforce Classic to complete this challenge.

Share Time Estimate