Wednesday, June 28, 2017

Data loader and import wizard in salesforce:

Import Wizard:
  • For simple imports of up to 50000 records.
  • It supports all custom objects and only few standard objects like Account, Contact, Leads, Solution.
  • It supports schedule export.
  • Delete operation is not available.
  • We cannot export data.
  • It doesn’t require installation.
  • While importing, duplicates can be ignored.
Data Loader:

  • For complex imports of any size more than 50000 records.
  • It supports all standard and custom objects.
  • It doesn’t support schedule export.
  • Delete operation is available.
  • We can export data of all custom & standard objects, and can import all custom & standard objects except User standard object.
  • It requires installation.
  • While importing, duplicates cannot be ignored.
Data Loader  is a tool or Application used in salesforce to import and export bulk data. ThroughApex Data Loader we are able to Update, Insert, Delete, Upsert, Export and Export All. Each operation will be different from each other.
  • Insert – insertion of new records
  • Update – Updating existed  records.
  • Upsert – Update and Insertion of records
  • Delete – Deletion of records.
  • Export – Extraction of all records.
  • Export All – It extracts all records from salesforce including Recycle Bin records.

Can We Bypass The Required Fields In Data Loader?

Ans: Inserting the records through Data loader Required fields cannot be skipped. If you have Required fields in your object make sure you have values in the CSV for those fields as well. There is no setting to by bass the required field check. although you can turn off the validation rules simply uncheck the Active check box.

What Are The Required Fields When Inserting Users Through Data Loader?

Ans:
  • Alias
  • Username
  • Email
  • First Name
  • Last Name
  • Locale (LOCALESIDKEY)
  • Language (LANGUAGELOCALEKEY)
  • Email Encoding (EMAILENCODINGKEY)
  • Time Zone (TIMEZONESIDKEY)
  • Currency (CURRENCYISOCODE)
  • ProfileId (not profile name but rather the 15-character ID from the URL of the profile in the UI) 

How to differentiate commas within field while uploading using Data Loader ?

Ans: Data Loader cannot differentiate this implicitly because there is no logical path to follow. In this case Data Loader CSV file for import will contain commas for any of the field content, you will have to enclose the contents within double quotation marks ” “. Data Loader will be able to find this.
Hard Delete Not Working In Apex Data Loader?

Ans: Check your Profile permissions  “Bulk API Hard Delete” check box should be enable  for permanently deleting the records using Apex Data Loader. Using Hard Delete operation, we can delete existing records from our Salesforce organization permanently. Deleted records will not be available in Recycle Bin.
Bulk_API_Hard_Delete

How To Import MultiSelect Picklist Values Through Data Loader?

Ans:  By using apex data loader inserting or updating multi select pick list fields through the Apex Data Loader, multiple values for the mulit picklist field are separated by a semi-colon “;”.
How To Import Different Languages?
For example: for a multi select field “Products”, containing the values Product1,Product2 and Product5, the .csv spreadsheet column for inserting or updating the data would be entered as “Product1;Product2;Product5“.

How To Import Different Languages Data Into Salesforce?

Import Different Languages Data Into Salesforce

Ans: Follow the below simple steps to import different languages data using Apex Data loader.
  1. Open the .xls file that displays the other language characters correctly and which was prepared for import.
  2. Click File –> Save As. In “Save as type”, kindly select Unicode Text (*.txt).
  3. Click “Save” button.
  4. Open the .txt file in Notepad.
  5. In Notepad, click File –> Save As, In“File name”, change the file’s extension from .txt to .csv. “Save as type”, select “All Files”, In “Encoding”, select “UTF-8”, Click “Save” button.
  6. Import the .csv file.

How To Change Lead Owner For Bulk Of 


Records?

Ans: Using the data loader to update lead owner on bulk of records with in 1 min. follow the below simple steps.
  1. First Export the Leads to which owner has to be changed.
  2. While exporting select Lead ID(Id) and Owner ID(ownerId) without fail.
  3. Modify the exported file ownerId with the user Id of the user to which Lead has to be assigned.
  4. Now update the Leads. that’s it.
    Data loader Login Error "Parser Was Expecting Element" ?
    data_loader_error

    Ans: While login to the data loader it says  "Parser was expecting element". Go to data loader settings then Follow the below simple steps to fix it.

    Also Read: How To Start Loading Data From 101 Row Of The CSV File In Data Loader?
    1. Make sure "API Enabled" permission is checked on the Profile.
    2. Check whether you have given the proxy correctly.
    3. Check whether you have given the port number correctly.
    4. Check whether you have given the correct url(for Production - https://login.salesforce.com and for Sandbox - https://test.salesforce.com).


What Are The Salesforce Editions Supports Apex Data Loader?

Ans:  The Data Loader requires the use of the Force.com API. If your Salesforce edition allows the use of the API ,you can use apex dataloader.  Now, ProfessionalEnterprise and Unlimited edition supportsdata loader

How To Start Loading Data From 101 Row Of The CSV File In Data Loader?

Ans: Open your data loader then Menu section Go to Settings–>scroll down  and Set “Start at Row” field to start the process from the 101 row number from the CSV file.
You can see the below screen.
 

How Can We Bypass Workflow Rules When Using The Data Loader?

Ans: We don’t have any option to skip workflow rules,Validation rules and Triggers from data loader.But we can deactivate the workflow rules while loading data through data loader. But it’s not a good practice,why because that the workflow can be deactivated in the app before using the Data Loader, but users can be creating/editing records during this process which should not be interrupted

How To Skip Triggers And Validation Rules From Apex Data Loader?

Ans: We can skip the trigger and Validations rules while loading the data through data loader Manually deactivating and activating trigger and Validations. But We are having large number of triggers andvalidation rules in our salesforce production org. We also do manual dataloader operation frequently.It is time consuming and on top of that it also affects live production users. It’s not a good practice
 It would be really good if dataloader can provide facility to skip triggers and validation rules ( e.g. to provide checkbox to skip ) while running dataloader operation.
What is an External Id in data loader in salesforce?
Suppose we have account table in Salesforce and account table outside of the Salesforce (ex: .csv file, sql database). In Salesforce all the records can be identified with record id and outside of the Salesforce we can't recognize records with Salesforce id that is the reason to compare outside table and salesforce table in Salesforce for one of the field we have to enable external ID (we can enable external id for text, number, auto number and email). If we enable external id we can compare that particular column with the column which is available in external table. While comparing if the both column values are same then it will update otherwise it will insert.
                                                                OR
          An external ID field is simply a field which is a unique identifier for your record, other than the Salesforce Id, usually coming from an external system. For example, if you are importing accounts, you may have a field called 'ERP Account Number' which is the identifier for your Accounts inside your ERP system.

How To Assign Permission Set For Multiple Users Through Data Loader? 

Ans:   To assign Permission Set for multiple Users using apex data loader, follow the below steps,

  1.  Create a .CSV file with User id and Permission set id to be assigned.
  2. Login into Apex Data loader.
  3.  Click “Insert” button.
  4.  Select “Permission Set Assignment” as object and browse the .csv file created in step1
How To Use Upsert Operation With Apex Data Loader?
Upsert_operation_in_salesforce

Ans: Upsert opeation makes use of the sObject record's primary key(Salesforce.com Record Id) or the external ID, if specified to determine whether new records should be created or else we have to update the existing records.

 What is the difference between update and upsert?

Key points to remember while upsert operation. 
  • If the key is not matched, then a new record is created.
  • If the key is matched once, then the existing record is updated.
  • If the key is matched multiple times, then an error is generated and the object record is neither inserted nor updated.
What are the difference between DATA IMPORT WIZARD PILOT and IMPORT WIZARD?

(or) WHAT IS A DIFFERENCE BETWEEN DATA LOADER AND IMPORT WIZARD IN SALESFORCE?

Answer:  
DIFFERENCE_BETWEEN_DATA_LOADER_AND_IMPORT_WIZARD

The Data Import Wizard provides a unified interface that lets you import a number of standard Salesforce objects, including accounts, contacts, leads, and solutions and custom objects. It Is designed for less-technical users and smaller, simple imports of up to 50,000 records.
         The Data Import Wizard is currently available through a pilot program. It is automatically enabled for all Developer Edition organizations. To enable the wizard for Enterprise and Unlimited Edition organizations, contact salesforce.com.
.SDL
In dataloader settings we should enable 'insert null values' checkbox otherwise we can't insert null values.
10,000 records and minimum 1 record.
2,000 records.
.CSV (Comma Separated Values)
  1. Insert (Inserting brand new records, no need of ID)
  2. Update (Updating the existing records based on the record ID)
  3. Upsert (To Upsert we should have one external ID field on the object, based on the external id field if the value already exists it will update, if doesn't exist then it will insert)
  4. Delete (Delete the records based on the id provided, to delete we need only id, deleted records can be found in recycle bin)
  5. Hard delete (Delete the records based on the id provided, to delete we need only id, deleted records can't be found in recycle bin, Note: If we enable bulk API in data loader settings then only we can perform Hard delete.)
  6. Export (From any object we can export records based on the SOQL query, Note: We can't export deleted records which are there in the recycle bin)
  7. Export all (From any object we can export records based on the SOQL query, Note: Using Export all we can export deleted records which are there in the recycle bin also)
After Exporting data using Data Loader, Some time it appears that data is on New Line (Carriage Return) when we open CSV file in Microsoft Excel. For example, Address Data separated on different lines. How can we override this problem?
Excel does all sorts of “useful” operations when it opens a CSV file. It will re-format dates, strip leading zeros, corrupt record IDs if you have them in your report, and also break line. Best way as per my experience is Upload document to Google Drive. Export document back from Google drive as Excel.
5. What is the filed mapping file format of the data loader?
SDL( “Salesforce Data Loader” file of Field mapping)

Trigger Scenario: 
I have requirement fire the trigger when data is uploading through data loader. It should not execute when record saved from User interface? How to achieve that?


You could add a custom checkbox field which is hidden from the pagelayout.
· This field could be mapped to always insert as "true" with dataloader.
· Make your after insert trigger only execute conditionally on this field to be true.
· Optionally have your trigger set the field to false, or you could keep it as true to see that these records were imported through data loader.

Q) We are not providing some of fields in .csv file which are required in page layout level .what happens if we try to insert records into sales force through data loader ?
A) All records are inserting in sales force successfully.
Q) We are not providing some of fields in .csv file which are required in field level .what happens if we try to insert records into sales force through data loader ?

A) Except those records remaining records will be inserted in to sales force.

1. Is it necessary to define an explicit primary key in custom objects?
No. Every object has a standard field called id. There is no need to define an explicit primary key in custom objects. The standard id field can be used as primary key.

2. In which order, we upload data in salesforce for related objects?
When loading data into a salesforce application dependencies between objects determine the order in which objects are loaded. If there is a one-to-many relationship between A and B, the data for A should be loaded before the data for B.

3. What is Upsert and how external id are beneficial?
Upsert is an API function that combines insert and updates into a single call. Upsert uses an indexed custom field or external ID to determine whether to create a new object or update an existing object.

-If the external ID is not matched, then a new object is created
-If the external ID is matched once, then the existing object is updated
-If the external ID is matched multiple times, then an error is reported
Use Upsert when importing data to prevent the creation duplicates.

4. What is import wizard?
It is easy to use tool to load Accounts, Contacts, Leads, Solutions, or Custom Objects.

-Load 50,000 records or less.
-Prevent duplicates
-Doesn’t support all standard object but supports all custom object

5. Which is API based tool supported by Salesforce and what are its advantages?
Apex Data Loader

Advantages are:-

-Is a fully supported salesforce.com product.
-Supports import from CSV or export to CSV.
-Can be used to import or export more than 50,00 records.
-Supports loading from or exporting to a database via JDBC.
-Supports custom relationships for upsert.
-Can be run from command line.

6. Can we avoid duplicates using apex data loader which we can do through import wizard?
No.

7. What is Bulk API?
The Bulk API is used to upload high volume of data (millions of records).
The Data Loader uses the SOAP-based Web Services API by default. To use the Bulk API instead, check “Bulk API” checkbox in apex data loader settings page.
When you check Bulk API checkbox, increases the batch (upto 10000 records) which is usually 200 in normal upload.
Hard delete bypasses the Recycle Bin, so deleted records do not consume storage space and there is no way to retrieve them.

8. What is difference between “Export” and “Export All” in apex data loader?
Export: It will fetch only active records from salesforce.
Export All: It will fetch active as well as records from recycle bin.

9. True or False: Users can mass transfer records to which they do not have read access?
False

10. What is DateTime format supported in .csv file for upload in salesforce?
YYYY-MM-DDThh:mm:ss.00Z

11. Is there is any option to specify time zone for uploading records in apex data loader?
Yes. Present in settings page of apex data loader.

12. When “Hard Delete” button will be enabled in apex data loader?
When you enable Bulk API setting in apex data loader.

How to handle comma within a field while uploading using Data Loader?

In a Data Loader .CSV, if there is a comma in field content, you will have to enclose the contents within double quotation marks: ” “.

Salesforce Data Loader: sandbox and null values

If you are using Salesforce Enterprise Edition or Unlimited Edition, you can use Data Loader to import, update, delete or export data to/from any object in Salesforce.com

Login to sandbox instance
By default, after Data Loader installed, it is configure to login to Production instance. You need to change in Data Loader setting to point it to sandbox instance.
Goto Settings and find "Server host (clear to turn off)", type: https://test.salesforce.com

Update fields to null
If you update a field to null / blank, and you notice the data is stay the same (not updated to blank), you need to change in Data Loader setting.
Goto Settings and find "Insert null values" and tick this checkbox.








Mass upload/insert non-English characters to Salesforce

We can mass upload / insert data to Salesforce easily using Data Loader or other API tool. But, if we get the data in Excel file with non-English characters, non-English characters will be come ?? if we save it to CSV file directly from Ms Excel.

To able to upload in non-English characters, the file should be in UTF-8 and here is a step by step procedure that needs to be done since it is a limitation of Excel to save non-English character to csv file.

[ MS Excel ]
1. Open the *.xlsx file from MS Excel
2. Click menu > Save As
3. Put any name for the file and choose "Unicode Text (*.txt)" for "Save as type :" and Click Save

[ MS Notepad ]
4. Open the unicode text file using Microsoft Notepad. Some characters can appear as a box, however, this is because Notepad cannot display some unicode characters, so you can ignore this at this point.
5. It must be the tab delimitered file. Replace tabs with comma (,)
- select tab character by dragging the character between two column headers and press Ctrl+C
- Replace all tab characters with comma using Replace function (Ctrl+H)
6. In notepad, Click Save As
7. Put a filename and change Encoding: to "UTF-8"
8. Click Save.

[ Windows File Explorer]
9. Change the file extension from "*.txt" to "*.csv". The file icon should be changed to MS Excel now. If it is not changed, check Windows Folder options. (Windows Start menu > Control Panel > Folder Options > View tab > uncheck "Hide extensions for known file types"). This will show the file extensions. Try changing the file extension again.

[ MS Excel ]
10. Open this CSV file from Excel and verify if the data is okay.
*** Even if you find any problem in this step, you should NOT save the file from Excel. It will cause the encoding problem!! Just check the data only in Excel. If you see a data problem at this stage, fix the data from the original spreadsheet and repeat the steps again. Or, you can change it from Notepad but should ensure that the file is saved as UTF-8 format.

You can download sample csv file with non-English characters saved in UTF-8 encoding here.

1 comment: