Start tracking your progress
Trailhead Home
Trailhead Home

Add Custom Fields

By default, your custom object has some standard fields on it. You need to add more fields to store relevant information about each suggestion. Fields can store many types of data. Feel free to explore these later as you extend your app. For now, let’s add a few that we know we need.

  1. Click Setupand select Setup. This launches Setup in a new tab.
  2. Click the Object Manager tab.
  3. From the list of objects in the dropdown, click Suggestion.
  4. Click the Fields & Relationships section.
  5. Click New.

Add a Description Field

This field is used by employees when they explain their suggestion.

  1. For Data Type, select Text Area (Long), and click Next.
  2. Fill in the custom field details:
    • Field Label: Suggestion Description
    • Length: 32,768
    • Visible Lines: 10
    • Field Name: Suggestion_Description
    • Help Text: Please enter as much detail around this suggestion so we clearly understand your idea.
  3. Click Next.
  4. Click Next again.
  5. Click Save & New.

Add a Category Field

This field helps us categorize each suggestion. It also makes it easier for us to report on what types of suggestions we get the most.

  1. For Data Type, select Picklist, and click Next.
  2. Fill in the custom field details:
    • Field Label: Suggestion Category
    • Field Name: Suggestion_Category
    • Select the radio button Enter values, with each value separated by a new line.
    • Enter the following values for the picklist (one per line):
      • Customer Service
      • Employee Services
      • Facilities/ IT
      • Kitchen Snacks
      • Other
  3. Deselect Restrict picklist to the values defined in the value set.
  4. Click Next.
  5. Click Next again.
  6. Click Save.

Try Out the App

Click App Launcherand select Suggestion Box. Click the Suggestions tab, and click New. You should see that your two custom fields were added to the Suggestion page. Fill in a sample suggestion and click Save.

Try adding a record in the Salesforce mobile app, too. Note that the Suggestion page layout is the same on the browser as it is in the mobile app. That's the power of “build once, deploy anywhere” metadata.

Viewing Objects in Schema Builder

Schema Builder provides a dynamic environment to add new custom objects, custom fields, and relationships to your Salesforce database. It also eliminates the need to click from page to page to add a new custom field to an object or to find the details of a relationship.

Screenshot of the Schema Builder

Let’s take a look at the Suggestion custom object in the Schema Builder.

  1. Click Setupand select Setup. This launches Setup in a new tab. From Setup, enter Schema Builder in Quick Find, then select Schema Builder.
  2. From the Objects Palette, click Clear All and then select the Suggestion object and the User object.
  3. If you don’t see your objects in the Canvas area, click Auto-Layout and drag them around until you like how they are arranged.

Let’s add more fields so that you can track the progress of a Suggestion.

Add a Status Field

This field helps track the status of the suggestion. It is also a way for the suggestor to know what is going on with their suggestion.

This field will have unique security protocols in that only admins can change the status.

  1. Click the Elements tab. This displays all of the new things you can add to your database schema: objects and fields.
  2. Drag the Picklist field type and drop it on the Suggestions object.
  3. Fill in the custom field details:
    1. Field Label: Status
    2. Field Name: Status
    3. Values: (one per line)
      1. New
      2. Under Consideration
      3. In Progress
      4. Implemented
  4. Select Use first value as default value.
  5. Click Save.

You should see the Status field at the top of the list of fields in the Suggestion object’s box in the schema diagram.

Next, we update the Status field’s security. 

  • While still in the Schema Builder, right-click the Status field that you just added to the Suggestion object. Click Manage Field Permissions.
  • Select Read-Only checkbox at the top of the column to make this field read only for all users.
  • In the Read-Only column, deselect System Administrator then click Save.

Add a Date Field

This field helps track when the Suggestion was Implemented. It’s also important because we reference this field in the formula field we create in a later exercise.

This field will have unique security protocols in that only admins can change the date.

  1. Drag the Date field type and drop it on the Suggestions object.
  2. Fill in the custom field details:
    • Field Label: Implemented Date
    • Field Name: Implemented_Date
    • Leave the defaults for the remaining fields.
    • Click Save. You should see the Implemented Date field at the top of the list of fields in the Suggestion object’s box in the schema diagram.

Next, we update the Implemented Date field’s security. 

  1. While still in the Schema Builder, right-click the Implemented Date field that you just added to the Suggestion object. Click Manage Field Permissions.
  2. At the top of the column, select Read-Only to make this field read only for all users.
  3. In the Read-Only column, deselect System Administrator, then click Save.

Try Out the App

Go back to the Suggestions tab in the browser, or to the Suggestions object in the Salesforce mobile app, and create a new Suggestion record.

Notice anything? Where are our two new fields we just created, Status and Implemented Date?

Don’t worry, they are there, just not on the page layout. When you use the Field Wizard, you have the option to add the field to the page layout automatically. When you use the Schema Builder, you need to add the field using the Page Layout Editor. In the next exercise, we do that, and make some other modifications to the user experience to make the app easier to use.

Resources