Data Modelling in Salesforce
Tags: salesforce, datamodeling, developers
Published: 2021-05-03 04:37:57

##**What is Salesforce?**
Talking about Salesforce, it is a cloud-based Software-as-a-Service (SaaS) Customer Relationship Management (CRM) platform that brings the company and its customers together. It is a well-known integrated platform that offers various products for Sales, Service, Marketing, Community, Commerce, etc., and it brings all these products into its single integrated platform. 
Furthermore, Salesforce allows complete customization for the organizations to fit their specific business user needs. It is also required to understand how Salesforce works first and then know how the data model is to be designed.

##**What is Data Modeling in Salesforce?**
In simple words, a data model is the architectural, structured way of storing data in an application. The Salesforce platform provides a standard model for one to customize data models for custom functionality. The Salesforce Data Model is essentially how data tables are represented within the Salesforce database to make one understand to anyone who views them.

Data modeling helps one in making sense of the data that is residing within the system. It helps in establishing specific relationships between the Salesforce objects as well as fields. This is further necessary to perform distinct CRM activities. The salesforce data model is a cumulation of the Salesforce objects and fields, making it essential for Salesforce users to be well acknowledged with these terms to understand better data modeling and how it works.

To understand the Salesforce Data Model properly, one needs to have proper knowledge of objects, fields, and records in Salesforce and insight into how to use them.

###**About Salesforce Objects:**
Salesforce objects are nothing but the tables of data within the system. The various columns (fields) and rows (records) present in these tables enable users to store and process the business data in an organized manner. There are further three major types of objects involved in the Salesforce object model – Standard Objects, Custom Objects, and External Objects. 

The Standard Salesforce Objects are the objects created by Salesforce and come pre-built when the CRM platform is further implemented. These objects are crucial to the core functionality of Salesforce and all such objects necessary to perform the basic CRM activities that are already present in the application.
Talking about Custom Objects, they are the objects created by users after implementing Salesforce, mostly if the pre-existing Standard Objects are not enough to comply with specific business requirements. The above-mentioned objects are quite unique to an organization and are further created in order to serve their specific needs.
Lastly, External Salesforce Objects are the objects that help the users map the data stored outside the platform of Salesforce. They are similar to custom objects in their functions.

Don't forget to Read this amazing blog by **Cyntexa** on [Aura Components vs Lightning Web Components](https://cyntexa.com/blog/aura-components-vs-lightning-web-components/)

Salesforce further allows its users to establish specific relationships between two or more of its objects to undertake specific processes.

###**About Salesforce Fields:**
A field is like a custom Database column. Fields are similar to the columns that work in Spreadsheet or any database table. They are further divided into Standard and Custom Fields. 

Standard fields are the predefined fields that are included as standard within the Salesforce application. They cannot be deleted, but non-required standard fields can be removed from page layouts whenever required.
Custom fields are unique to everyone's business needs, and not only they can be added and amended but also deleted. Creating custom fields allows one to store the information that is necessary for the organization.

Both standard and custom fields can be customized to include custom help text, which will help users understand how to use them. Every field has a data type that indicates what kind of information to be stored in the field.

###**About Salesforce Records:**
Records are similar to rows that are present in the database table or spreadsheet. A record may be text, number, date, checkbox, formula, Date & Time, or any other data type of the column or fields. According to Salesforce documentation, Record types allow different business processes, picklist values, and page layouts to different users. One might also create record types to differentiate the regular sales deals from the professional services engagements, offering different picklist values for each.

Object Relationships in Salesforce:
In order to understand the Salesforce data structure, it is essential to have full knowledge of two major object relationships that are supported by Salesforce – Lookup Relationship and Master-Detail Relationship.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rphu7l29o2e6kmbmx6u8.jpg)

**Lookup Relationship:**

If two of the Salesforce objects are connected through a Lookup relationship, the fields of one Salesforce object can be accessed by the other object. There are two significant ways of establishing a Lookup relationship: one-to-one and one-to-many. The Salesforce objects connected through such a relationship might or might not be connected.

**Master-Detail Relationship:**

A Master-Detail relationship can be described as the object relationship wherein one of the connected Salesforce objects is termed as the master (or parent) object, and the other one is termed as the detail (child) object. In such a relationship, the behavior of the child object is always monitored by its parent object. The user is further required to specify the parent object before storing its child object within the database. As opposed to the Lookup relationship, the objects in a Master-Detail relationship are always strongly connected.

##**Designing Salesforce Data Model:**
When one knows about how the data is used, modeling that data can be further done. One of the best data modeling procedures is to reduce the custom objects and use more standard objects. This procedure is not applicable when integrated data needs to be stored. 

When external data is loaded into the standard object, one must see how the data is used in the standard objects.

**Data Management:**
Salesforce or any other CRM is data-oriented, which further makes it the environment's responsibility to manage the data issues like importing or exporting data. To maintain the data, various built-in features are present in Salesforce, and they are briefly discussed as follows:

**Importing the Data:**
The valuable data taken from the external platform onto Salesforce CRM is a critical activity required to be monitored closely. It is important to ensure that the data entering the system is relevant and not duplicated. There are two significant ways in which one can import data into the system:

Data Loader – This is specifically a client application that can be further put to use for importing data in bulk. It allows one to import a maximum of five million records at once, which could belong to any data type, and further decide whether to import data from files or a database connection. Salesforce Data Loader can be also operated via the user interface or command line.
Data Import Wizard – This is a known Salesforce tool that can be accessed through the Setup menu. This tool lets the users import data from common Standard Objects along with the data stored in Custom Objects. This tool facilitates the import of up to 50,000 records at a time.

**Exporting the Data:**
One can export necessary sets of data from Salesforce manually or through an automatic schedule. The data is always exported in a set of specific comma-separated values (CSV) files. The data export tools of Salesforce provide users with a copy of one's data which can be used either for backup purposes or importing the same into another system.
There are two effective methods of exporting the data from Salesforce:

Data Loader – Like importing data, the Salesforce Data loader can be used to export the data, which is to be installed separately. This client application can be further operated through the user interface or the command line.
Data Export Wizard – This is an in-browser wizard that can be accessed from the Setup wizard. With this tool's help, one can export the data either once every seven days for a weekly report or once every twenty-nine days for a monthly report. Salesforce Data Export Wizard also allows users to export necessary sets of data weekly or monthly automatically. 

##**Conclusion**

The Data modeling in Salesforce is required to model the data that is present in the database. In order to understand the relationship between the objects tables are being used. In data modeling, there are different types of objects and different relations among those objects. Salesforce professionals have to study data modeling to handle the data while maintaining relationships among the objects and then move forwards with designing it and managing the data.