Data Management in Salesforce
How to load data into Salesforce objects?
I have created my salesforce application and i have to enter my data into salesforce. I have only 5 records in one of my object, so I can simply go to tab and will create records in salesforce. But in one of my object i need to load bulk (thousands of) records, to enter thousand of records will take more time by entering manually and also it is very difficult and no one will enter thousands of records manually. Here I am providing information about how to load data into salesforce by using automated tools.
Salesforce providing two ways to load data into Sobjests. One way is “load data by using import wizard from your setup menu” and other way is load data by using data loader.
Import wizard vs Data loader
To work with import wizard no need to install any tool, directly from setup menu and we can use it.
By using import wizard we can load data of Accounts, Contacts, Leads, Solutions and Custom Objects.
By Using import wizard we can load data up to 50,000 records.
We cannot load duplicate records by using import wizard.
We can also schedule exports by using import wizard.
Data loader is a tool provided by salesforce. We can download this from setup menu.
By using data loader we can perform Insert, Update, Upsert, Delete, Hard delete, Export & Export All operations.
We can load 5,00,000 records at time by using data loader.
And also by using command line interface we can schedule dataloads.
By using data loader we can load data of all Sobjects.
Working with Import wizard to load data:
In salesforce to navigate to import wizard go to Setup -> Administer > Data management
Here i will explain you how to use import wizard and other options to load data in to salesforce objects:
Data import wizard in salesforce
Data import wizard provides you load the data into salesforce . By using this wizard we can insert, update & upsert the records.
By using this we can can import up to 50,000 records. It won’t allow you to load duplicate records.
By using this you can load Accounts, Contacts, Leads, Solutions and Custom objects.
Here i am posting how to use new data import wizard in salesforce.
To navigate data import wizard go to Setup > Administer > Data Management > Data import Wizard and click on Launch Wizard.
See the below screen for reference.
After clicking on Launch Wizard you will navigate to Below Screen
Observe above screen here we have to do 3 steps to perform import operation.
1. What kind of data you are importing: Here you need to select object you want perform import operation. Here you can select Accounts, Contacts, Leads, Solutions or any Custom object.
2. What do you want to do? : Here you need to specify which type of operation you are going to do ( Add new records, Update existing records, Add new and update existing records).
3. Where is your data located? : Here you need specify from where your loading data? i.e. you need to specify your csv file path
See the below screen to understand what I have done in 3 steps.
Step 1 : Select your required object. Here we are selecting Books object under Custom Object Tab
Step 2 : Choose what do you want to do. Here we are selecting Add New Records
Step 3 : Upload your CSV file and then click Next button
After clicking Next button map your CSV columns with salesforce fields.
Once your done with mapping click on Next you will get review screen to review what you are going to do.
After reviewing your selections click on Smart import button
Click on OK, then you screen will navigate bulk data load job page There you can monitor your job status. And also you can see the results also.
Note :This wizard is simple to load the data up to 50000 records. Here i have given example to add new records only(insert). If you want you can update existing records (update) and also you can add and update exsting records(upsert)
Salesforce Data Loader
What is Salesforce Data Loader? and why we use data loader?
Salesforce Data Loader is a tool provided by sales force to perform following opearation on data.
By using Salesforce data loader you can load up to 5,00,000 records.
Salesforce data loader good tool to load bulk amount of data into your Sobjects.
By using Salesforce data loader you can schedule the loads.
Insert, Update, Upsert, Delete, Hard delete, Export, Export All
When importing data, Data Loader reads, extracts, and loads data from comma separated values(CSV) files or from databasa conections. When exporting data, it outputs CSV files.
We can use data loader in following 2 ways.
Key features of the data loader
– An easy-to-use wizard interface for interactive use
– An alternate command line interface for automated batch operations
– Support for large files with up to 5 million records
– Drag-and-drop field mapping
– Support for all objects, including custom objects
– Can be used to process data in both Salesforce and Database.com
– Detailed success and error log files in CSV format
– A built-in CSV file viewer
– Support for Windows 7
Import Wizard vs Salesforce Data Loader Data Loader
Use the Salesforce Data Loader Data Loader when
– To load the data greater than 50,000 we will go for data loader. We can load up to 5,00,000 records at a time by using data loader.
– To load the data into an object that is not supported by the import wizards.
– To schedule regular data loads, such as nightly imports.
– To export data for backup purposes.
Use the import Wizard when
– By using import wizard we can load below 50,000 records.
– The object you need to import is supported by import wizard. Go to setup -> Data management here you can find what are all the objects supported through import wizards.
– You want to prevent duplicates by uploading records according to account name and site, contact email address, or lead email address you can use import wizard.
Installing Data Loader
- Log in to your salesforce application.
- Go to setup > Data management > Data Loader
see the following image for reference
- Install that downloaded file in your machine.
- To start data loader double click on short cut on your desktop or go to Start > all programs > salesforce.com > Apex data loader > Apex Data loader.
Following is look and feel of data loader.
Once you clicked on data loader you will navigate to another screen there you can download data loader.
To log in to data loader you must need Security Token. To get the token follow the following steps.
Generate Security Token in Salesforce
Click on My Settings under your name at the top right side of your screen
Click on Personal > Reset my security token and then click Reset Security Token button
After clicking Reset Security Token button salesforce sends the token in your register mail id. Copy the( the token is case sensitive) token from your mail. To login into data loader you have to type Password+SecutityToken in dataloader. See the reference guild line below.
Login in dataloader by clicking any operation. Here we sre clicking Export button
Login with your credentials, during login provide your username and “your org password + security token”, which you already generated. and then click Login button.
After login below screen will display. Select your object. Here we are selecting Books object and then click Next button
Select you required fields. here we are choosing id, name and then click Finish button
After clicking Finish button you will see the operation popup. click the View Extraction button and see the result
Salesforce Data Loader Operations
Click on Import button and then NEXT and select the object you want to insert the records and choose the .csv file you want upload.
Note: Data loader allow only .csv files.
Map the fields by using drag and drop
Click on ok or save the mapping if need in future.
Click on NEXT and then click on Finish. After inserting records it will display error files and success files.
To update the records click on Update button.
Next select the csv file contains updated records with IDs and sect the object and complete the operation.
Upsert also same as update but here we can insert new records also.
By using this operation we can insert new records and update existing new records.
Export means down loading the data from organization
– Click on export button and then login with your credentials.
– Select the object you want to export data and specify the folder where you want to save this exported file.
– And then finish the operation
Export All: “Export All” means it will give the data including data in recycle bin.
Delete means it will delete data from your organization. To delete the data you want export the existing data with ID’s and then by using this file we can delete the data. The data deleted by this operation will be available in recycle bin. If want delete data permanently choose hard delete option.
To delete data from object follow below mentioned activities
– Click on delete button and login with your org credentials.
– Select the object you want to remove the data. And select the csv files with record id’s you want remove.
– Map the ID field and then complete activity
Hard delete means deleting the data permanently from the org. That mean data will not be stored recycle bin. To enable this button enable bulk API. To enable bulk API button go to data loader settings and then enable bulk API check box.