In the first tutorial, Quick Tutorial 1: Build a Cloud App in 5 Minutes, you created a cloud app for managing merchandise in a warehouse. Behind the scenes, Force.com created a database for the app. This tutorial is the first of many that teach you how to continue building the database for your app.

A database organizes and manages data so that users can work with it efficiently. Traditional relational databases use tables to manage discrete, possibly related, collections of information, organized further into datatype-specific columns (attributes) and rows (records). In Force.com, you refer to these as objects.

Qs2 schema builder 01.png

Your Force.com DE org comes with many standard objects (e.g., Accounts, Products, Tasks) that support pre-built apps (Sales, Marketing, etc.). Any new objects you create are called custom objects. The Merchandise object is one such custom object. In this tutorial you'll take 5 minutes or so to add two new custom fields (Price and Inventory), to supplement the standard fields that it already has (Name, Owner, CreatedBy, and LastModifiedBy).

Prerequisites

You must complete Quick Tutorial 1: Build a Cloud App in 5 Minutes before continuing with this tutorial.

Step 1: Access the New Custom Field Wizard

From the Force.com Quick Access menu (the tab that pops out from the right side of the window), hover your mouse over View Fields and click +New to switch from your app to the New Custom Field wizard that's part of the Force.com development environment.


Qs2 quick access.png


Note: Alternatively, you can navigate to the New Custom Field wizard by clicking <your_name> | Setup | Create | Objects, click the Merchandise object, scroll down to Custom Fields and Relationships and click New.

Step 2: Add the Price Field to the Merchandise Object

The New Custom Field wizard lets you quickly specify everything about a new field, including its name, labels to use for app pages, help information, and visibility and security settings.

  1. For the data type, select Currency and then click Next.
  2. Fill in the custom field details as follows:
    • Field Label: Price
    • Length: 16
    • Decimal Places: 2
    • Select the Required checkbox to make the field value required.
  3. Leave the defaults for the remaining fields, then click Next.
  4. Click Next again to accept the default field visibility and security settings.
  5. Click Save and New to finish and start the wizard again to add the next field.

Step 3: Add the Quantity Field to the Merchandise Object

Now create a Quantity field in the same manner.

  1. Select Number and then click Next.
  2. Fill in the custom field details as follows:
    • Field Label: Quantity
    • Select the Required checkbox.
  3. Leave the defaults for the remaining fields, and click Next and Next again.
  4. Click Save.

The Merchandise record should now have the following fields.


Qs2 fields.png

Step 4: Try Out the App

In the first tutorial, you created one Merchandise record with just a name (Laptop). Edit your first Merchandise record and create a few more Merchandise records with all of the fields, including the new Price and Quantity fields.

  1. Click the Merchandise tab to leave setup and return to the app.
  2. Click Laptop, Edit, then specify Price and Quantity:
    • Price: 500
    • Quantity: 1000
  3. Click Save & New to save the record and start a new record.

Before you move on, take note how Force.com automatically added the new Price and Quantity fields to the form for editing Merchandise. Your app's user interface is automatically evolving along with your database. Nice!


Qs2 merchandise edit 1.png


Now create two new Merchandise records with the following attributes:

Tell Me More

Take a close look at a record of merchandise. Notice the object's standard Owner, CreatedBy, and LastModifiedBy fields, which Force.com automatically manages. App users can possibly edit the Name standard field, along with the custom fields Price and Quantity.

Qs2 tell me more.png


Also take a look at the Recent Items sidebar. This handy feature lets you view and navigate to the most recently touched records in your database. The link names in this sidebar come from each object's Name field.

Next Steps

While you can add new Merchandise records to your warehouse, you don't have a way to create or track orders for Merchandise. The next tutorial teaches you how to continue building your database by creating a new custom object, Invoices.