Schema Builder in Salesforce

Salesforce Schema builder aids in developing customer objects, custom fields along with relationships for the schema. In this way, users can get information about what they are looking for. The schema will be the blueprint of the database. Just like any database, we can create the schema in Salesforce as well. Let’s discuss a use case before we go into more detail.

With the previous tutorials,  by this time you have already created custom objects, custom fields, and relationships. However, with more entities and objects, the database is getting much more complicated. So, you might need a different blueprint for your database or you might need to customize the existing data model.

Creating a new data model or new blueprint for the database will be a cumbersome task, as you need to start from scratch. Moreover, if the database is in production, then there is no scope to create a new one or replace the existing one. In this case, we can use the Schema Builder that helps to visualize the data model and edit it as per needs.

The capability of the Schema builder

The schema builder is enabled by default. However, users can add more items to the existing scheme.  The items which could be added are listed below.

  • Master-Detail relationships
  • Custom Objects
  • Lookup Relationships
  • Fields
  • Auto Number
  • Formula
  • Checkbox
  • Roll-Up Summary
  • Currency
  • Date
  • Number
  • Email
  • Date/Time
  • Picklist
  • Phone
  • Percent
  • Text Area
  • Text
  • Long Text Area
  • Encrypted Text
  • URL
  • Rich Text Area

Accessing Salesforce Schema Builder

  • Go to setup, and in quick find type “Schema Builder”. Else, one can navigate to the schema builder, which is located in the “Build” section.

  • In case you want to check the existing schema, then click “Clear All”. Suppose, you have selected the object contact, offer, favorite, and property, then these components will show up in the build area. Then click on Auto Layout.  We see the schema as shown below,

The above objects can be easily dragged out around the canvas. This will not change the objects in the canvas or the relationships that exist around them. But, it will help to visualize the data model. You will get a clear picture of the data flow between the different entities.

As we have mentioned previously, the schema is the blueprint of the database. In case you are a database administrator and you want to explain the database to another co-worker, then you can simply show the schema. The schema will clearly outline the entities and the relationship amongst them.

How to create an object with Schema Builder

We can create objects using the schema builder. We can create these objects on the visual interface. Thus we can visualize our object, while we are creating it. Visual interfaces always aid in better system design.

  • Go to the Schema Builder, as mentioned in the last section.
  • Once you are in the Schema Builder, click on “Elements”. The elements tab will be located on the left sidebar.
  • Now select the object from the left side, and drag to the canvas area. Enter the required information for your new object, and click on “Save”. Once it is saved, the new object will be listed in the schema builder tool.

Create Fields

Let's do more with the object that we have created in the last step. Let's add some fields as well. It is obvious that without the fields, the object is of no use, as we cannot add a record with data.

  • To create the fields, let's go to the Elements table located on the left sidebar.
  • In the next step choose a field type, and associate it to the object that was created previously. This can be done by dragging the field to the object. We can create formula fields, normal fields, and relationship fields.
  • Fill the required details of the field, and click on “Save”. If you come back to the object manager, you will see your newly created object is listed over there, and you can explore just like any other object. You can explore the fields associated with the object, along with the other properties.

Changing Objects

The schema builder allows us to work with multiple schema objects. We can view these objects on the right pane, and start working on them. However, we can modify only the custom objects and not the standard Salesforce objects.