Data management in Salesforce
- February 23, 2024
Data is the engine that drives the Salesforce instance. Data management comes into play when we are upgrading our system from an old customer relationship management (CRM) to a new CRM, decommissioning a legacy system or uploading purchased data and leads.
Any data operation is a complicated, expensive and risky proposition. Data migration requires professional expertise. Migration involves transforming and cleaning data, which improves user productivity.
We insert data into Salesforce, which is called data import. Tools provided by Salesforce for importing data include Data Import Wizard and Data Loader. Additional tools include partner tools on AppExchange, Workbench and Dataloader.io.
Data Import Wizard
- Easy-to-use tool to load accounts, contacts, leads, solutions, campaign members or custom objects
- Loads 50,000 records or less
- Prevents duplicate:
- Account name and site; account IDs
- Contact email address; contact name; contact ID
- Lead email address; lead IDs
To insert a record using Import Wizard, we use Record ID, which is a unique identifier of a record. It is a primary or foreign key field in a database table. Salesforce auto-generates an ID value when a new record is created i.e., a00D000005iTiZ. In ID, the first three digits represent the object type.
For example Accounts-001, Contacts-003, Leads-00Q, etc.
Salesforce.com Object IDs come in 2 forms:
- 15-digit case-sensitive version:
Obtained through reports.
- 18-digit case-insensitive version:
Obtained through the API. The last three digits of it are the checksum of the capitalization of the first 15 characters.
Data Loader
Data Loader is a client application for bulk importing/exporting data. It’s used for inserting, updating, deleting or exporting Salesforce records. Input to and output from are separated by value (CSV) files.
Data Export
- Accessible through the setup menu
- Manual export weekly (every 7 days) or monthly (29 days)
- In Professional Edition and Developer Edition, we can generate backup files for only 29 days or automatically at monthly intervals only.
Data Loader
- Export
- Export All (includes Deleted record)
Salesforce Reports
Data Export Wizard vs Data Loader vs Report
Data delete operation in Salesforce
Soft delete:
- When you delete the record, it’s moved to the recycle bin.
- The records can be restored and are available for querying.
- They count against your organization’s limits.
- For 15 days, we can view and restore recently deleted records in the recycle bin. After that, they’re permanently deleted.
Hard delete:
- If an object and its data are hard-deleted, they’re permanently erased.
- Data doesn’t count against your organization’s limits.
- Enabled through Bulk API or by an admin
Upsert operation:
- In the upsert function, we can combine inserts and updates into a single call.
- Upsert uses an indexed custom field record ID or external ID to determine whether to create a new record or update an existing record.
- Upsert is used to prevent the creation of duplicates during the import of data.
External ID:
- An External ID is a flag that can be added to a custom field to indicate that it should be indexed and treated as an ID.
- A custom index on any custom field can be of type: text, number or email.
- An External ID is available on all objects that support custom fields.
- An External ID is used with Upsert to integrate apps with other systems.
- An object can have up to 25 External fields.
Benefits of Upsert using External IDs
- Simplifies insert/update operations
- Don’t have to know Salesforce IDs
- Here we don’t need to export and match existing records
- Helps prevent duplicates
- Fewer API calls needed
- Allows use of relationships defined in legacy systems when importing data into Salesforce
- Very convenient for integrating and migrations
— By Rashmi