# Data Management
We deal with a few things about data in Salesforce in this chapter.
We love to deal with complex data.
-- No One
# Batch Data Processing
The typical way to get data in your salesforce org is for the users to type them in ๐. Unfortunately that is not always possible -
- There are other systems in the enterprise which collect data in hundreds or thousands of records
- You may be setting up Salesforce for the first time and importing data from an existing system
- Your company may be acquiring another company that has its own data set to be available for them to use the system
In all those cases (and probably hundreds more), you should consider -
- using the batch data processing utilities.
- integrating external systems using Salesforce provided APIs to import/export data
As part of admin course, we will explore a bit on the batch data utilities available within Salesforce in this section -
- Data Loader application (independent program supplied by Salesforce)
- Data import wizard (available within Salesforce app)
- Overview of third party batch data processing options
# Data Loader
Data loader is a desktop tool to batch import, update or export data to/from salesforce. You use files to source data when using data loader.
# Considerations for using Data Loader
Here are the typical considerations while doing any export/import of data-
- Identify the need for bulk operations
- Use Data Loader to-
- Create field mapping
- Work with fields and attachments
- Use data import wizard (within app) and Windows-based Data Loader tool
- Work with basic SOQL/SOSL
- Effect of Apex rules, workflow, assignment rules on Data Loader
# Installing Data Loader
Data loader is an independent program to batch process data. Refer the Data Loader installation instructions to install the program for your operating system. It essentially consists of two steps-
- Install OpenJDK
- Go to Setup > Integration > Data Loader. Download Data Loader and set it up on your device
# Using Data Loader
To use Data Loader, you first create mappings to map columns in your file to the fields in Salesforce.
- Admins (or super users) can create mappings within Salesforce for Data Import
- Data files (including relationships ) need to identify a Salesforce id, or external id for upserts
- Can be created manually or using data manipulation routines outside Salesforce
- Data Loader tool is typically used by admin / support team โ has advantages over the data import wizard
Exporting data will include following steps -
Import data process will look like this -
The development life cycle consists of -
- Design backing up routines for data that will get impacted
- Design data transformations external to data loader
- Change values or structure of data in the file
- Third party utilities like Informatica ETL/Cloud help streamline these processes for larger enterprises
- Design data map - map fields to columns
- Design test cases - automated checks and manual tests. Include process testing as part of data testing (e.g. check whether order management goes through just fine for the products being imported)
- Import in sandbox. Conduct system tests for data loads and for backup routines
- Import in production
Data Loader can process records in bulk and you should set a good enough number for you.
Note that data loader by itself cannot be scheduled to run at a specific time or to repeat job executions, but you can use the Command Line arguments to run the data loader and schedule the program using external schedulers available for your operating system. (typically this is done on a server machine.)
# Data Import Wizard
Data import wizard is available through the Salesforce app and should be your go-to tool for simple batch processing routines.
Access data import wizard by going to Setup > Integrations > Data Import Wizard.
Click on Launch Wizard for a guided screens to get started.
- Choose entities
- Choose your operation - insert, update, insert & update
- Choose your file
- Create/edit mappings between the input file and Salesforce fields
- Start import!
As you see, this is simpler than using data loader.
- No need to install anything, and the tool is available within Salesforce app
- You can schedule export
- You can get alerted on data duplicates and choose to ignore duplicate records while importing data
On the other hand -
- It supports only record sets up to 50,000 records
- Although data import wizard supports all custom objects, only a few Salesforce default objects are supported (e.g. Accounts, Contacts, Leads). Data Loader supports all custom and Salesforce provided objects (excluding users)
- You cannot delete records
- No export facility available (Data Loader supports exports)
# Third Party Data Processing Utilities
Data loader provides an easy solution to import data, but is not always effective for all use cases. For example -
- You need complex data transformation before loading data to Salesforce
- You need custom roll-back logic for treating data exceptions
- Establish entity relationships for inbound data using custom keys or using complex logic
- You need custom error handling for sensitive data
Large enterprises with complex data needs often consider external tools to data integration.
The third party data processing utilities also call Salesforce batch data API to load data (similar to Data loader), but provide additional functions to make your life easier (at a cost of course). Common functions provided by external programs -
- Manipulate data before feeding into salesforce (or even generating files for data loader)
- Provide better ways to create relationships with less manual intervention
- Custom error handling and better control on rollback
Your org-wide API limits apply for any data processing operations using these third party utilities.
Examples -
- Jitterbit Data Loader for Salesforce
- Apsona app
- Mulesoft (part of Salesforce in Q2 '18, but is additional cost)
- Informatica Cloud / On Premise solution with Salesforce Connector
- Salesforce Connector in Heroku
- Talend & other solutions that manipulate data structure and values before files are processed by Salesforce Data Loader
# More on Data Management
# Duplicate Rules
Duplicate rules enable you to define criteria that will signal potential duplicates.
Using duplicate rules, you can -
- Provide guidance to user viewing information when there are duplicates
- Define possible actions when the record being created is a potential duplicate
- Can limit searching for duplicates in the records that user has access to or can span the entire data set
Duplicate rules play together with 'matching rules' to do their work. Salesforce provides standard rules for accounts, person accounts, contacts and leads.
To create a duplication rule -
- Go to Setup > Home tab
- Find for Duplicate Rules or locate that under Data > Duplicate Management
- Click on New drop-down and select the object where you want the rule to be created
- Allow or block creation of potential duplicates by selecting values from picklist
- Enforce or bypass sharing rules by selecting the relevant options
- Select a matching rule against the object (it is a good time to remind you to create one & activate it if you don't have that yet)
- Select additional filter criteria to apply to matching rules (for e.g. do not consider accounts of status 'Long Dead')
Matching rules provide you a way to select one or more fields to compare in order to identify duplicates.
Note that -
- There can be more than one duplicate rule. If a potential duplicate rule is triggered by a rule, subsequent rules are skipped
- Max 5 duplicate rules can be created against an object
- Duplicate rules are not triggered in special circumstances -
- when records are being created in 'weird ways' customer self-registration, or when using quick create
- when restoring record from recycle bin
- when record is being manually merged
- Data being created/updated through APIs or from batch routines can ignore duplicate rules and trigger their own logic
Duplicate rules enable a simple but powerful data control in organisations that allow anyone to create accounts/contacts/leads or believe in The Chaos Theory.
# Workshop
No. | Type | Description | Time (hrs) |
---|---|---|---|
1 | Do | Explore data wizard | 0.5 |
2 | Do | Explore data loader | 0.5 |
3 | Do | Explore mass data changes | 0.5 |
4 | Do | Explore dataloader.io/other | 0.5 |
# Explore data wizard
- Export contacts
- Import new contacts using the contact template
# Explore data loader
- Export visits
- Create new patients if necessary
- Import visits using the visit template, associate visits with Doctors, patients
- Import bed assignment data for patients
# Explore mass data changes
- Change status of โDormantโ customers to active if there is a visit in the last one week
# Explore Dataloader.io / Other
- Explore third party tools to export/import data