What if there is an effortless way to view, modify, design, and implement data models in your org. Behold, the Schema Builder! A dynamic environment on Salesforce with a drag and drop interface simplifies the task of designing, implementing, and modifying your data model. The visual depiction helps us understand complex Salesforce Data Models all the more! Let’s learn more about this!
What is a Schema in Salesforce?
In programming, a Schema (pronounced SKEE-mah) refers to the organization or structure of a database. In Salesforce, it depicts a skeletal structure of all Objects and Relationships in an org. This architectural blueprint of the Data Model describes the shape of data and how it relates to other data within the organization. 🡪 It gives us a logical view of the entire Data Model.
What is a Schema Builder in Salesforce?
The Schema Builder is a simple graphical interface for editing, viewing and creating Data Models in Salesforce. Schema Builder includes details such as – Fields, Required Fields, and Object Relationships – for both Standard and Custom Objects.
Steps to create a Schema in Salesforce
Let’s start by viewing our current Schema, following which we’ll learn how to navigate the Schema Builder environment.
How do we get to the Schema Builder?
Follow the step-by-step instruction to access the Schema Builder.
1. Click the gear icon( ) on the top-right corner of your org and select Setup.
2. In Setup, type in Schema Builder in the Quick Find Box.
3. Click Schema Builder.
4. And Voila, we’ve reached the Schema Builder!
It should look like the image above! Now, what? Being able to View the Schema is not good enough, we should be able to navigate through the environment to make the most of it! Let me break it down for you.
Let’s look at how each tab and menu in the environment function.
Note: You can hover over an object or relationship to learn more
Elements and Objects Tab
On the left corner, you can see these tabs, and they expand to display a menu. What do they stand for?
1. Elements – Include all Field Types except Geolocation. You can drag and drop an object or a field onto an object to add a new custom field.
2. Objects – You can select objects to display on the canvas here. The drop-down list includes all Objects in the org, and you can filter the menu to view just the Selected, Standard, Custom, or System Objects in the list. ( From the Object tab, you can Click Select All | Clear All to either display the entire data model on the canvas or clear the canvas).
Used the close the Schema Builder and save the layout of your objects.
Click Auto-Layout to sort the layout of the objects in your schema. ( You cannot undo it)
Include the following options.
- Display Element Names / Display Elements Labels – Click this option to view either the element names or element labels of all the fields in your schema, depending on whether you prefer system names or text values.
- Hide/ Show Relationships – To hide or show the relationship lines.
- Show/Hide Legend
It helps us to understand the charted data better.
Zoom in or out using this button.
The Map in the bottom-right corner shows the overall layout of your objects.
These steps in no way include the complete picture. For a better understanding, we need to work on the environment. Let’s start by creating an object followed by a field using Schema Builder.
Steps to create an Object with Schema Builder
Navigate to Schema Builder in Settings and follow these steps to create an object.
- In the left sidebar, click the Elements tab.
- Click on Object, and drag it onto the canvas.
- Enter information in the Create New Object Menu as per your liking.
- Click Save!
That was it, we just created an object using the Schema Builder, that was pretty cool, wasn’t it!?
Steps to create Fields with Schema Builder
Now that we’ve created an object. Let’s add fields to it:
- In the left sidebar, select the Elements tab
- Choose a field type of your liking and drag it onto the object you just created
- Fill out the details in the pop-up window.
- Click Save!
And we’re done! If you go to Setup | Object Manager, you can find the object and field you created there. To learn more, try creating Master-Detail and Lookup relationships between objects, and simply try new options and create more fields and objects.