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 itxs 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:
- Standard Objects: These are the objects that are predefined by the salesforce and readily available.
- 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)
- 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-manyx
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
- 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.
- Generating a report out of excel is tedious while salesforce.com comes with many pre-defined reports and report parametersÂ
 Thatxs 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
- Introduction to Cloud Computing (Salesforce.com and Force.com)
- Overview of Database Concepts (Salesforce.com)
- Introduction to Force.com
- Building Salesforce Custom App and Objects
- Object Relationships and Formula Field in Salesforce
- Salesforce Security Model and Overview
- Automation in Salesforce
- Approval Process in Salesforce
- Introduction to SOQL and SOSL
- Introduction to Apex
- Salesforce Data Management
- Visualforce MVC Architecture on Cloud
- Salesforce Reports and Dashboards
- Building a Visualforce (Custom) Page for the Salesforce App
- Salesforce Sandbox and Overview of Force.com capabilities
- Learning Apex and Deployment Tools
x