What is Data model in Salesforce?

Design and implement your data model in Salesforce with a simple point-n-click UI to define custom objects, fields, relationships, formulas and more. The database is tightly integrated with other parts of the platform providing reporting and search capabilities for all objects with no extra effort.

Salesforce is a CRM platform. Being a CRM platform generates a lot of data. It also transacts with different data segments. We can say that Salesforce is a data-oriented platform. However, huge chunks of data can generate real-time problems, specifically in terms of data management. The good thing is Salesforce as a platform provides robust data management methodologies. We can easily update the records associated with the object, we can easily create a new one, and delete the records as well. We can also import data from external sources. Similarly, we can export data to external sources as well. Data management is completely flexible on the Salesforce platform.

Data Model

To learn about data management, let’s learn about the data model of Salesforce first. The data model defines how the data is stored in Salesforce. Every platform has its data model. In Salesforce, the data model is made up of the following entities:

  • Objects.
  • Fields.
  • Relationships.
  • validation Rules.
  • Page Layouts.

In Salesforce, we have objects such as accounts, leads, contacts, etc. Each object will have associated records. For example, contact will have records associated with contact details, that might be made up of different fields. One of these fields might relate to another recordset. For example, Account ID might be the same in both the records associated with the contact object and the accounts object. This is known as relationships between the records. Some of the relationships we have already discussed are a master-detail relationship and a lookup relationship. Salesforce provides multiple to import/export data and work with them. Some of these options are listed below:

  • Data Import.
  • Apex DataLoader.
  • Integration.
  • Excel Connector.

Salesforce allows multiple activities to be done on the data. Some of the common activities that are performed are listed below:

  • Create new records – Import.
  • Edit existing record – Update.
  • Delete existing records.
  • Export record
  • Transfer record Ownership.

Importing Data in Salesforce

We can easily import data into Salesforce, from an external source. This includes any sources or programs which can save the data into CSV format. However, if you don’t have the data in CSV format, there are multiple third-party tools available which can save the data in CSV format, and make it ready for import into the Salesforce org.

Salesforce offers two different tools for importing data,

  • Data Import Wizard: Data Import Wizard can be accessed through the Setup menu. You can import data associated with the common standard objects. This includes objects such as contacts, accounts, leads. It can also import data in custom objects as well. However, it can import only up to 50,000 records at a given instance. It has a fairly simple interface and it is user friendly. We can specify the configuration parameters, along with data sources & field mappings. It has to be noted that field mappings are important in this case, as it maps the field names in your import file with the field names in Salesforce.
Data model in Salesforce
  • Data Loader: Data loader is a client-based application that is capable of importing up to five million records at a given instance. It is flexible, as it allows us to import any form-data type. We can import data either from the files or even form a database connection. It is available in both, GUI as well as CLI. In the case of CLI, you have to specify the data sources along with field mappings, and other parameters through a pre documented configuration file. This allows us to automate the import process, by using the API calls.DL1

As we can understand, these tools need to be used as per the requirement. If the number of records is less than equal to 50,000, then Data Import Wizard can be used. However, if it is more, then we have to use the Data loader tool.

Export Data

Salesforce supports both manual data export and automated data export. There are multiple reasons, why we might have to export. We can export the data for backup or even presenting to an external entity.

Key tools for exporting data are:

Data export service: It is an in-browser service. This tool can be accessed through the Setup menu. With the help of the data export service, we can export data manually once every 7 days (for weekly export) or in 29 days (for monthly export). We can also export the data automatically at a predetermined period. It could be weekly or monthly intervals. Weekly exports are available in Enterprise, Performance, and Unlimited Editions. In Professional Edition and Developer Edition, you can even generate backup files every 29 days. The backup file generation can be automated even without any manual intervention.

Data model in Salesforce

Data Loader: Data loader can be used for import, as we have discussed in the last section, it can be used for export as well. It is a client-based application and needs to be installed separately. The data loader can be operated in both CLI as well as GUI mode. This also supports manual as well as automated data export.

Data export service is more feature-rich when it comes to data export. As it provides multiple options, for exporting data at different intervals. However, for simple requirements, where we don’t need backup, only export needs to be done, Data Loader is a better option.