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:

  1. Click +NEW in the top menu.
  2. Click the Connection button in the menu on the left.
  3. 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).
  4. The default name of a new connection is Untitled. Just click it to rename the connection, for example, to 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.

    Connection Editor window

  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 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.

    Log In window

  8. Click Create Connection.

    Connection Editor window 2

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

  1. Click +NEW in the top menu.
  2. Click the Connection button in the menu on the left.
  3. 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).
  4. The default name of a new connection is Untitled. Just click it to rename the connection, for example, to Dropbox1.

    Connection Editor window

  5. Click Sign In with Dropbox.
  6. In the window that opens, enter your Dropbox credentials and click Sign In.

    Sign In window

  7. In the window that opens, click the Allow button.

    Allow window

  8. Click Create Connection.

    Connection Editor window 2

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

Creating Package

  1. Click +NEW in the top menu.
  2. In the Integration column, click Import. The import package details page will open.
  3. 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.
  4. To load data from Dropbox, click CSV from storage service.
  5. 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.

    Source Connection

  6. Under Target, in the Connection list, click Select target and select Salesforce connection from the drop-down list.

    Target Connection

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 new link to open the Task Editor.
  2. 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.

    CSV Mode

  3. 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.
  4. Select Product2 in the Target list.

    +Selecting Product2

  5. Click the +Related button. A new drop-down list will appear.
  6. In this new drop-down list, select PricebookEntry.

    Selecting PricebookEntry

  7. 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.
  8. Map the Product2 fields to the corresponding source columns.
  9. To map PricebookEntry object fields, click the target table name (Product2) and select Product2.PricebookEntry in the drop-down list.

    Target table name

  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.

    Configuring constant mapping

  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 target lookup by constant to map the Pricebook2Id field.

    For this, perform the following steps:

    1. Click Column and then, in the drop-down list, click Target Lookup.
    2. In the Lookup Object list, select Pricebook2.
    3. In the Result Column list, select Id.
    4. In the Lookup Key Column list, select Name.
    5. Under Lookup Key Column, click Column and then, in the drop-down list, click Constant.
    6. Enter “Standard Price Book” (without quotes) to the box below.

      Target Lookup

  13. Click the Save button to save the task.
  14. Click the Create button to create the package.