Database Concepts in Salesforce

Salesforce is a CRM platform. Being a CRM platform, it has to deal with a huge chunk of data. This data is organized and stored into different databases, which are also referred to as Salesforce objects. This tutorial will discuss the database concepts that exist in Salesforce. Salesforce also deals with the RDBMS database, just like any other data-oriented platform.

Concepts of objects

In Salesforce, the database is made up of different objects. Here the object can be a table or a database itself. There are multiple fields associated with the object, which stores the data. We can think about in the same way, a table with different columns as fields. Here each record will resemble a row.

In simple words, the objects store all the information on the Salesforce platform. Salesforce maintains the information in form of Record and Field, where both of them are associated with specific objects. For example, an Account is an object. It will store information related to AccountID, Account Name, Account Owner, etc.

Salesforce has three types of objects:

  • Standard Objects: These are the standard and out of box objects that are present on the Salesforce platform by default. We can also refer to it as system objects. These objects are available without any additional packages or additional customizations.
  • Custom Objects: Custom objects are developed by the users as per the user requirements or organizational requirements. Each of the custom objects has five fields, that can store data.
  • External Objects: These are the objects that can map to the data that are stored outside the organization.

Some of the common fields of the Salesforce objects:

  • ID: This is the Unique ID, that acts as an index for the object. For example, for the Account object, there is AccountID, which is a unique identifier for the account. The ID needs to be between 15 to 18 digits.
  • Name: This is the name of the object. Such as Account Name, associated with the Account Object.
  • Owner: This resembles the owner of the record associated with the object. For the Account object, it will be the Account Owner.
  • Created Date: This refers to the date of creation. For example, the date of creation of the specific account.
  • Last Modified Date: This field will store the last modified date. For example, the last date when the account was modified or updated.

There are multiple objects available on the Salesforce platform. But, all of them are not available or authorized for access, to all the users. Access to the objects is purely determined by certain factors. These factors include user permissions, object configuration, data sharing model, user permissions, and several other factors. Most of the objects on the salesforce platform that is -available through the APIs, will have the read-write access. But, some of them will be read-only.

Relationships in Salesforce

Relationships are the most important element in the databases, that define the relationships between the entities that are stored in different databases. The relationship will be always implemented on the child object. The child object will also have complete access to the parent object. Based on different types of database operations such as data deletion, data ownership., security, etc, we can define different types of relationships.

  • Many to One relationship: In this type of relationship, there will many child objects but only one parent object. Many to one relationship will be based on different forms as listed below:
    • Master-Detail: In the case of one parent object with multiple child objects, the record associated with the child object will be automatically deleted, if the master object is deleted. The parent object needs to be always referenced, whenever a child object needs to be created. The owner field is by default related to the owner of its associated master record.
    • Lookup: In case of lookup, the child objects are treated independently. The child objects also have a separate setting from the parent object. If the parent object is deleted, the child object will remain in the system. In the case of Lookup, the child might not have a parent at all.
    • Hierarchical: It is similar to the lookup relationship, but it will be defined only on the user object. In this form of relationship, one user is associated with another user, with the help of the lookup field.
    • Self: This type of relationship is applicable in the case of a self-referred object.
  • Many to Many: In many to many relationships, each of the records of a particular object is associated with multiple records associated with other objects in Salesforce, and vice versa. A custom junction object is created for many to many relationships, and then the master-detail relationship fields are linked to these objects.
  • Junction Objects:  Junction objects are used for creating many to many relationships. In Salesforce, two types of relationships are supported, lookup, and master-detail, but both are categorized as one to many relationships. Hence, we need a junction object to create many to many relationships.

 Salesforce is a full-fledged RDBMS based database, and just like any other database, the Salesforce objects can be queried with normal SQL queries, from the Salesforce platform itself.