Schema Builder pt. 2: Creating Custom Objects & Fields

By in
1065
Schema Builder pt. 2: Creating Custom Objects & Fields

As discussed in part 1 of the Schema Builder blog series, Schema Builder in Salesforce can be used to modify your org’s data model by editing and creating custom objects and fields. Today, we’re going to practice utilizing Schema Builder to do just that!

Note: To follow along with the steps below, use or create a Playground from Salesforce Trailhead or a Developer Edition org.

 

Create a Custom Object

  1. Once in your Salesforce org, click the gear icon to open the Setup menu.
  2. In the Quick Find search box, search for “Schema Builder” and select to open it.
  3. In the panel on the left side of the screen, select the Elements tab.
  4. Next, drag and drop the Object icon from the panel to the canvas.Create a Custom Object in Salesforce Schema Builder Modify Data Model
  5. A “Create New Object” window will pop up on the canvas – enter your new object information as follows:
    Field Value
    Label Property
    Plural Label Properties
    Allow Reports Check
    Add Google Docs, Notes and Attachments related list to default page layout: Check

    New Object Field Schema Builder Salesforce Modify Data Model

  6. Then click Save.

Now you can see your new, custom object on the canvas. The Legend also shows fields with a red vertical line next to them. Those are required fields that must be completed for your new object.

Object in Schema Builder Salesforce Data Model

Next, let’s create a custom field on our new, custom object.

 

Create a Custom Field for the Object

  1. Select the Currency icon and drag and drop that on top of the Property object.
  2. A “Create Currency Field (Object: Property)” window will pop up on the canvas – enter your new field information as follows:
    Field Value
    Field Label Price
    Field Name [defaults to ‘Price’]
    Description The listed sale price of the home.
    Required Check

    Create Custom Field Schema Builder Salesforce

  3. Then click Save.

Now you can also see your new, custom field included in your Property object with a red, vertical line next to the Field Label. As previously mentioned, the red line is indicating that it’s a Required Field.

Object with new field

Next, let’s create one additional custom object that we’ll then relate to the Property object.

 

Create Another Custom Object and Field

  1. Enter the below information for the new, custom object:
    Field Value
    Label Offer
    Plural Label Offers
    Description Offers related to a Property.
    Record Name Offer Number
    Data Type Auto Number
    Display Format OF-{0000}
    Starting Number 0001
    Allow Reports Check
    Track Field History Check
    Add Google Docs, Notes and Attachments related list to default page layout: Check

    Another Custom Object Schema Builder Salesforce

  2. Click Save.
  3. Then enter the below information to also add a custom field to the new, Offer object:
    Field Value
    Field Type Currency
    Field Label Amount
    Field Name [defaults to ‘Amount’]
    Description Amount of the offer for a property.
    Required Check

 

Relate the Two Objects

  1. Now, create a Master-Detail relationship between the Property object (Master) and the Offer object (Detail).
    • When creating Master-Detail relationships in Schema Builder, we want to start the relationship from the child object and relate it to the parent object. Therefore, you need to select the Master-Detail icon and drag and drop that on top of the Offer object to properly relate the two objects.
    • Fortunately, hovering over the Master-Detail icon provides information about what object we should start the relationship from, so there’s no need to memorize this.Relationships Salesforce Schema Builder
  2. Complete the following information for the relationship field:
    Field Value
    Field Label Property
    Field Name [defaults to ‘Property’]
    Related To Property

    Master-Detail Relationship Salesforce Schema Builder

    • Ultimately, what this relationship is doing is creating a field where we can look-up the Property record an Offer is related to.Object in UI
    • The Child Relationship Name and Related List label are displayed on the corresponding Property record when the Offers related list is added to the Property page layout.Related List in UI
  3. Click Save.

On the canvas, we can now see that the Property object and the Offers object has a Master-Detail relationship connecting them as indicated in the Legend by the maroon line.

We can also see that the relationship line on the canvas indicates that we’d have a single parent record to possibly many child records by the branched connection to the Offer object.

Master-Detail in Salesforce Schema Builder View Data Model

 

Create Tabs for the New Objects

Next, let’s create Tabs for our custom objects so we can easily navigate to them.

  1. Click the Close button in the Schema Builder header
  2. In the Quick Find search box, search for “Tabs” and select to open it
  3. In the Custom Tabs section, click the New button
  4. For Object, select Property from the dropdown list
  5. For Tab Style, click the magnifying glass to select an icon
  6. Click next, next, and save.
  7. Repeat steps 18 – 21 for the Offer object

Now, we can easily locate our two new objects in our navigation menu and create records for them if we want.

Setting Tabs

 

Schema Builder in Salesforce is a great way to view and update your org’s data model. The visual aspects of Schema Builder also allow us to show the design of our data model to other users for a better, faster understanding.

 

Additional Resources

Cover Photo by Raoul Ortega on Unsplash

Leave a reply

Your email address will not be published. Required fields are marked *