Salesforce Tutorial# 2: Overview of Salesforce Database Concepts

In our first tutorial, we have seen some basic concepts about cloud and cloud vendors. We learned that Salesforce.com is one such cloud vendor that has gained popularity due to its flexible service offering.

In this second tutorial, we will see some more concepts about the database in Salesforce.com. We will see how salesforce relates to other RDBMS databases available out there. We will see the similarities in the concepts but differences in naming and execution. We will see how data is created, the relationship among data is maintained.

2.1  Salesforce Database Concepts:

In Salesforce.com database is an organized collection of objects. The term object refers to information. We use database tables to collect (or store) the information about things, people, or concepts that are important for us and may require in the project for further use.

In salesforce, we refer to this information as an object. In a database, the information in the table is presented with rows and columns. Salesforce it’s maintained as Record and Field. Example in an Employee table the information about ID, Name, Contact Information, Designation, Salary, etc are stored. So Salesforce terms Employee would be an Object and ID, Name, etc would be its Fields

2.2 Salesforce Database Structure:

In Salesforce.com objects are of three types:

  1. Standard Objects: These are the objects that are predefined by the salesforce and readily available.
  2. Custom Objects: These are the objects created by the user according to their need. Each custom object has five standard fields (refer Note 2.2.1)
  3. External Objects: These are the custom objects which are used to map the data stored outside your organization.

NOTE 2.2.1:

  • ID: This is an index allocated to each object. This value is unique. ID can be of 15 digit (Case sensitive) and 18 digits (Case insensitive)
  • Name
  • Owner
  • Created Date/ Created By
  • Last Modified Date/ Last Modified By

Apart from this salesforce.com provides some objects available in the API, we can access only authorized objects. Access to objects is determined by many factors such as object configuration, user permissions, access settings, data sharing model, and other factors related specifically to the object. Most of the objects accessible through the API have read-write access. However, few objects are read-only.

Relationships defined in Salesforce.com

There are several relationships that can be defined in databases. Relationships associate one object with another object.  The relationship is always defined on the child object. The child object has complete access to the parent. Based on the handling of data deletion, record, ownership, security different types of relationships are categorized into the following ways:

1) Many to One (Many child objects but one Parent Object)

E.g. many metro cities are associated to One Country.

This kind of relationship is represented in four different forms like

  • Master-detail
  • LookUp (Loosely Coupled Relationship)
  • Self
  • Hierarchical

  Master-Detail (1: n) — (One Parent Object and Many Child Objects)

  • The record of the child object gets automatically deleted when we delete the master object.
  • To create a child object parent object reference field is required.
  • Child object does not have separate sharing but it derives from a Parent object, the detail records inherits the sharing and security settings of the respective master record.
  • The Owner field is automatically set to the owner of its associated master record as the owner field is not available at the detail side (child object).
  • The detailed record must have the master-detail relationship field on its page layout.
  • Administrators select Allow reparenting option in the master-detail relationship definition to represent child records in a master-detail relationship on custom objects.

Master-detail relationships can be defined in two custom objects. One can define this relationship between one custom object and one standard object but in such a relationship the standard object cannot be on the detail side of a relationship with a custom object. The data of the custom objects is displayed on a page layout.

Note:  master-detail relationship can’t be created on objects where the User or Lead objects are the master.

Lookup (1: n) — Lookup is also one-to-many relationship but in this relationship, two objects have no effect on deletion or security.

  • Child objects are independent
  • Child object have a separate setting
  • If we delete parent object child objects will remain in the system.
  • Child may or may not have parent.

Self : In this relationship the object is self-referred. E.g. Add on Card on your credit card
Hierarchical: This is also (1: N) Lookup relationship but can only be defined on the User object. In this, we can use a lookup field to associate one user with another user. User objects may not directly or indirectly refer to themselves.

 2)   Many-to-many

master-detail relationships can be used to model many-to-many relationships between any two objects. In a many-to-many relationship, each record of one object is linked with multiple records from other objects and vice versa.  We need to create a custom junction object to create a many-to-many relationship and then master-detail relationship fields, are linked with these objects.

  • Junction object: This object is used to create Many-to-Many relationship. Salesforce supports two relationship master-detail and Lookup but both are 1:n that is one-to-many. To define a many-to-many relationship we need the third object and that is called a junction object.

2.3 Normal (Excel-based) Database vs. Relational (Salesforce.com) Database

  1. In Normal or excel based systems it may lead to having duplicate information several times. While in the Relational database the information is instances only once but can be referred by multiple fields.
  2. Generating a report out of excel is tedious while salesforce.com comes with many pre-defined reports and report parameters 

 That’s all for this session. Please come back to us if you have any questions related to Salesforce.com. Stay tuned for our next article in this tutorial series.

Here is our article series in case you missed to go through.

Tutorial Index

  1. Introduction to Cloud Computing (Salesforce.com and Force.com)
  2. Overview of Database Concepts (Salesforce.com)
  3. Introduction to Force.com
  4. Building Salesforce Custom App and Objects
  5. Object Relationships and Formula Field in Salesforce
  6. Salesforce Security Model and Overview
  7. Automation in Salesforce
  8. Approval Process in Salesforce
  9. Introduction to SOQL and SOSL
  10. Introduction to Apex
  11. Salesforce Data Management
  12. Visualforce MVC Architecture on Cloud
  13. Salesforce Reports and Dashboards
  14. Building a Visualforce (Custom) Page for the Salesforce App
  15. Salesforce Sandbox and Overview of Force.com capabilities
  16. Learning Apex and Deployment Tools

 

Add a Comment

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