To understand Data Modelling, we need to understand What is a Database?
Database is an organized collection of information. In a relational database, the data is stored in tables. Each table comprises of several columns of datatype such as Text, Number or Date. Information is stored in the rows of table and tables can be related to other tables using the concepts of primary key and a foreign key.
Whereas in Salesforce,
Database uses Objects to store data. Each object comprises a number of fields which corresponds to column in a database. Data is stored in the records of objects which corresponds to rows in a database. Objects can be related to other objects using relationship fields.
Objects:
Objects in Force.com are represented in the form of a table and it is here referred as what an entity in a database.
There are 2 types of Objects:
· Standard Objects:
The objects provided by salesforce.com are called standard objects. 7 types of standard objects are Accounts, Contacts, Opportunities, Leads, Products, Campaigns, Cases, Users, Contracts, Report, and Dashboards, etc.
· Custom Objects:
These are the objects created to store information unique to an organization. Custom Objects extend the functionality that Standard objects provide.
**Each object in Force.com has a built-in feature like user-interface, security and sharing model and much more.
Apps:
App in Salesforce is like a big container for all objects, tabs, and their functionalities. It is group of tabs that works as a unit to provide application’s functionality. It consists simply of a name, logo, and an ordered set of tabs. The simplest app contains only one tab like Home tab and a default logo.
There are 3 types of apps:
· Standard Apps:
Standard apps come with every occurrence of Salesforce as default. Community, Call Center, Content, Sales, Marketing, Salesforce Chatter, Site.com, and App Launcher are included in these apps. The description, logo, and label of a standard app cannot be altered.
· Custom Apps:
A custom Salesforce app includes a label, description and an ordered list of items or tabs that work together to solve a specific business problem.
· Console Apps:
Salesforce Console apps are a tab-based workspace suited for fast-paced work environments. Manage multiple records on a single screen and reduce time spent clicking and scrolling to quickly find, update, and create records. The console is perfect for Sales and Service folks.
Tab:
Tabs helps users to view the information at a glance. It displays the data of objects and other web content in the application.
There are mainly 4 types of tabs:
· Standard Object Tab:
It displays data related to standard objects.
· Custom Object tab:
It displays data entered /related to custom objects. These tabs look and function like standard objects but are different.
· Web tabs:
It displays any external Web-based application or Wb page in a Salesforce tab.
· Visualforce tabs:
Visualforce tabs displays data from a Visualforce page.
Visibility of Tabs:
· Default On: If the tab visibility is ON then it would appear on the top navigation bar along with other visible tabs.
· Default Off: It the tab is OFF then the user will still be able to access the tab but by clicking on+ sign symbol at the end of all visible tabs on top bar.
· Tab Hidden: It the tab is Hidden, then it will not be visible on tap navigation bar, not on clicking on + sign symbol.
Fields:
A field is one data point within an object. “Fields in Salesforce represents what the columns represent in relational databases. It can store data values which are required for a particular object in a record.”
There are 2 types of Fields:
· Standard Fields:
Standard fields are default fields built-in to Salesforce. They cannot be deleted and are always required.
4 standard fields we see in salesforce: Created by, Last Modified By, Owner, the field created at time of creation of object.
· Custom Fields:
The fields which are created by an administrator or developer to meet the business requirements for any organization. They can be deleted, modified, and may not be required.
Various data types have been provided by Salesforce to ease the use and creation of custom fields like: Text, Date/Time, Currency, Checkbox, Picklist, Number, Geolocation etc.
Fields can be dependent on each other and can control each other based on certain values. This is called Field Dependency.
Relationship:
A 2 way association/link in between two or more objects. With the relationship between objects, the access, connection and display of data and related data becomes easier. It can be created using fields and their dependencies on many sides or one side of the objects.
Types of Relationships:
· Master-Detail:
Closely links objects together such that the master record controls certain behaviors of the detail and sub detail record. For example, you can define a two-object master-detail relationship, such as Teacher—Students, that extends the relationship to sub detail records, such as Subjects they are studying. You can then perform operations across the master—detail—sub detail relationship.
· Look-Up:
Links two objects together. Lookup relationships are like master-detail relationships, except they do not get affected on deletion or security. With a lookup relationship, you can: Link two different objects and the data appears on the related list on the page layout of that object.
It can be sub-divided into 2 categories:
1. Hierarchal: A special lookup relationship available only for the user object. It lets users use a lookup field to connect one user with another that does not directly or indirectly refer to itself.
2. Self: A relationship of an object to itself.
· Many-to-Many:
A many-to-many relationship allows each record of one object to be linked to multiple records from another object and vice versa.
To create a many-to-many, just create a Junction Object between two objects. Like one object has two master-detail relationship with two other objects For example, you can define a many-to-many relation object, such as in a Recruiting app scenario: Job Posting Site->Job Postings<-Positions.
Validation Rules:
A validation rule is one way to restrict input in a table field or a control (such as a text box) on a form. Validation text lets you provide a message to help users who input data that is not valid. It can contain a formula or expression that evaluates the data in one or more fields and returns a value true or false as an error message.
Cross-Object Formula Field:
A Cross-object formula is a formula that spans (a type of bridge field) two related objects and references merge fields on those objects. A cross-object formula can reference merge fields from a master (“parent”) object if an object is on the detail side of a master-detail relationship. It is available on both Master-detail as well as Look-up relationship. An object can only contain up to 15 different object references.
Look-up Filter:
Lookup filters are administrator settings that restrict the valid values and lookup dialog results for lookup, master-detail, and hierarchical relationship fields. Salesforce Lookup Filter limits which records can be associated within an object relationship.
Roll-up Summary Field:
Summarizes the data from a set of related detail records and automatically display the output on the master record. These can be used to display the sum, maximum, minimum value of a field in a related list, also the count of all the records listed in a related list. Roll-up summary fields are read-only and will display the sum, minimum, or maximum value of a field in a related list or the record count of all records listed in a related list. For example, you can get a sum total of all opportunities at a particular stage for a given account.
Schema Builder:
It is a simple graphical interface/canvas for visualizing and editing the data model of your Org. The schema builder can get all fields from an Object, perform basic impact analysis of changes to an Object, and show all dependencies and relationships, all custom objects except Geolocation, without having to click from page to page.
Note: A good data model design makes it easier to scale your applications, maintain them, and take advantage of Salesforce features, including application security features.