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.
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:
- Click +NEW in the top menu.
- Click the Connection button in the menu on the left.
- In the opened Select Connector page, select Salesforce. To quickly find it, you can either use the Type to filter box or filter connectors by categories using the All list (for Salesforce, select the CRM category).
- The default name of a new connection is Untitled. Just click it to rename the connection, for example, to Salesforce1.
- 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.
-
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.
-
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 Sign 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.
-
Click Create Connection.
To create a connection to Dropbox, perform the following steps:
- Click +NEW in the top menu.
- Click the Connection button in the menu on the left.
- In the opened Select Connector page, select Dropbox. To quickly find it, you can either use the Type to filter box or filter connectors by categories using the All list (for Dropbox, select the Storage category).
-
The default name of a new connection is Untitled. Just click it to rename the connection, for example, to Dropbox1.
- Click Sign In with Dropbox.
-
In the window that opens, enter your Dropbox credentials and click Sign In.
-
In the window that opens, click the Allow button.
-
Click Create Connection.
Now we have created the necessary connections. Let’s create a package that performs the necessary data import operation.
Creating Package
- Click +NEW in the top menu.
- In the Integration column, click Import. The import package details page will open.
- Rename your package by clicking and editing the package name. The default package name is Untitled. Please note, if you omit this step, the package name will remain Untitled in the list of created packages.
- To load data from Dropbox, click CSV from storage service.
-
Under Source, in the Connection list, click Select source and select Dropbox connection from the drop-down list. You can use the Type to filter box to find the connection quicker.
-
Under Target, in the Connection list, click Select target and select Salesforce connection from the drop-down list.
Importing Products with Prices
The next task will import the Products table data to Product2 and PricebookEntry Salesforce objects. Perform the following steps:
- Click the Add new link to open the Task Editor.
-
Select the file to import from the CSV Path 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.
- Click the Next step button in the bottom of the dialog box to switch to next editor page. You can also switch between the editor pages by clicking the corresponding icons: Source Definition, Target Definition, and Mapping Definition.
-
Select Product2 in the Target list.
- Click the +Related button. A new drop-down list will appear.
-
In this new drop-down list, select PricebookEntry.
- Click the Next step button in the bottom of the dialog box to switch to next editor page or click the Previous step button to return to previous page.
- Map the Product2 fields to the corresponding source columns.
-
To map PricebookEntry object fields, click the target table name (Product2) and select Product2.PricebookEntry in the drop-down list.
-
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.
- Map the UnitPrice field to the source column, containing the prices.
-
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 target lookup by constant to map the Pricebook2Id field.
For this, perform the following steps:
- Click Column and then, in the drop-down list, click Target Lookup.
- In the Lookup Object list, select Pricebook2.
- In the Result Column list, select Id.
- In the Lookup Key Column list, select Name.
- Under Lookup Key Column, click Column and then, in the drop-down list, click Constant.
-
Enter “Standard Price Book” (without quotes) to the box below.
- Click the Save button to save the task.
- Click the Create button to create the package.