Importing Products with Prices from Dropbox

In this tutorial we will show how to import a file, uploaded to Dropbox and containing data on products, including their prices. The main problem of such an import operation is that, while prices are often stored in the product data, Salesforce uses more flexible approach, and offers a possibility to create several pricebooks, having different prices for the same products. Therefore, in Salesforce price data are stored separately from the product data, in the PricebookEntry object. Skyvia supports importing data from a single file to several Salesforce objects and builds relations between the corresponding objects automatically.

ExpandedToggleIcon        Creating Connections

In order to import data from a file, uploaded to Dropbox, to Salesforce, first we need to create connections to Salesforce and Dropbox. If you have already created the necessary connections, you may skip these steps. To create a connection to Salesforce, perform the following steps:

1.Click Connections in the menu on the left side of the page to switch to the Connections page.
2.On the Connections page click the New button.
3.In the opened pane click Salesforce.
4.Specify the connection Name, for example, Salesforce1.
5.From the Environment drop-down list select the Salesforce environment type to import data to. Since this is just a sample walkthrough, the Sandbox environment is recommended.
6.From the Authentication drop-down list select the authentication method for connecting to Salesforce. If you don't mind storing your Salesforce credentials on our Skyvia server, select User Name & Password. If you prefer not to store your credentials, select OAuth 2.0.
 
salesforce-connection-oauth
7.If you have selected User Name & Password, on the previous step, specify your Salesforce account e-mail, password, and security token. Otherwise, if you have selected OAuth 2.0 authentication, click the Log In with Salesforce button and login via the Salesforce website on the opened page. The result OAuth token will be stored in the connection data. Your Salesforce credentials will not be stored on our website.
 
Login-to-Salesforce
8.Click the Save button to save the connection.
 
salesforce-connection-oauth-filled

To create a connection to Dropbox, perform the following steps:

1.Click Connections in the menu on the left side of the page to switch to the Connections page.
2.On the Connections page click the New button.
3.In the opened pane click Dropbox.
4.Specify the connection Name, for example, Dropbox1.
 
dropbox-connection
5.Click Log In with Dropbox.
6.Enter your Dropbox credentials and click Sign In
 
dropbox-sign-in
7.Click the Allow button.
 
dropbox-allow
8.Click the Save button to save the connection.
 
dropbox-connection-filled

Now we have the necessary connections created. Let's create a package that performs the necessary data import operation.

ExpandedToggleIcon        Creating Package

1.Click Integration in the menu on the left side of the page.
2.Click the New button in the top right corner of the page.
3.Click Import.
4.Click My PC near the Source heading and select Dropbox from the drop-down list.
 
selecting-dropbox-type
5.Select the Dropbox1 connection in the Source Connection drop-down list.
 
selecting-dropbox-connection
6.In the Target header click Select and select Salesforce in the drop-down list.
7.Select Salesforce1 in the Target Connection drop-down list.
 
target-connection-selection

ExpandedToggleIcon        Importing Products with Prices

The next task will import the Products table data to Product2 and PricebookEntry Salesforce objects. Perform the following steps:

1.Click the + Add Task to open the Import Wizard.
2.Select the file to import in the Source CSV drop-down list. This drop-down list displays folders and files from the specified source connections. You can open and close folders by clicking them.
 
file-from-dropbox
3.Click the Next button in the bottom of the dialog box. You can also switch between the Import Wizard pages by clicking the corresponding icons in the wizard header and return to previous wizard page by clicking the Previous button.
4.Select Product2 in the Target list.
 
selecting-product-on-multiple-objects
5.Click the Add Related button. A new drop-down list will appear.
6.In this new drop-down list select PricebookEntry.
 
selecting-pricebookentry-multiple-objects
7.Click the Next button in the bottom of the dialog box.
8.Map the Product2 fields to the corresponding source columns.
9. To map PricebookEntry object fields, select Product2.PricebookEntry in the Tables Mapping drop-down list.
10. For PricebookEntry we will map the IsActive column to be always true. Click the IsActive field and then in the Column drop-down list select Constant. Select True in the drop-down list below.
 
constant-mapping-bool
11. Map the UnitPrice field to the source column, containing the prices.
12. We also need to map the Pricebook2Id field, which stores the ID of Pricebook, the PricebookEntry belongs to. We will map it to the ID of the standard pricebook, which is automatically created for any Salesforce database. It has the name "Standard Price Book" by default. We will use lookup by constant to map the Pricebook2Id field.
 
For this, perform the following:
a.Click Column and then, on the drop-down list, click Lookup.
b.In the Lookup Object list, select Pricebook2.
c.In the Result Column list select Id.
d.In the Lookup Key Column list select Name.
e.Under Lookup Key Column, click Column and then, on the drop-down list, click Constant.
f.Enter "Standard Price Book" (without quotes) to the box below.
 
lookup-pricebookid
 
13. Click the Finish button to save the task.
14. Click the Save button to save the package.