Salesforce Platform Developer I Certification Guide
上QQ阅读APP看书,第一时间看更新

Data modeling

Lightning speed is the future, so we will be doing everything in the Lightning Experience interface version of Salesforce. Don't worry if you have only just created your Developer Org, this should be the default setting.

So, we know that we will mostly use Salesforce as a database. Data modeling helps us structure our data using custom objects and fields. Let's have a recap, as we already know what those are:

  • Object: This is used to store specific data, such as our Excel sheet called Accounts. We will need to create several objects to store specific data for our BIM DB app, such as Movie, Person (actor, actress, director), Review, and Company.
  • Field: This is used to capture specific data for a specific record of a specific object type; for example. each movie has a name, a release date, and a duration.
  • Tab: This is a representation of records for a specific object. You can choose whether you wish to create a tab for an object or not. The benefit is that you can create list views from the tab, which will show a list of filtered records of that object, for example, all movies with a release date in 2000.
  • App: This is a bundle of commonly and frequently used tabs, objects, fields, and permissions to support a specific business process; in our case, we'll create a BIM DB app.

Each standard or custom object automatically consists of a set of fields. There are several different types of fields:

  • ID: Each standard and custom object automatically gets an ID field, which acts as a unique identifier for records within the Salesforce database table. This is automatically populated by Salesforce and consists of 15 (unique case-sensitive) or 18 (unique case-insensitive) characters. Every record in Salesforce has a unique ID.
  • System Fields: Every object (standard or custom) in Salesforce has some read-only database fields that you can't delete or modify, and they are as follows:
    • CreatedDate: This is the date and time when the record was created in Salesforce, either manually or through an import
    • CreatedById: A relationship to the user who created the record, either manually or through an import
    • LastModifiedById: A relationship to the user who last updated (made any modification to it) the record
    • LastModifiedDate: This is the date and time when the last modification (update) was made to the record
  • Name field: This is a required field and is used as a more user-friendly identifier. It can be either Text or an Autonumber.

Of course, you can then create extra fields as per your business needs. One special type of field that you can create is a relational field, which is used to link one or more records together. We will go into more detail in the next section when we talk about relationship types, but, for now, just remember there are two specific field types to build relationships:

  • Lookup
  • Master-Detail