Skip to end of metadata
Go to start of metadata

Introduction

This page describes how to upload files to Salesforce using Data Loader. To demonstrate, we use an example of uploading four local files to a folder within Salesforce.

Begin a New Insert

Within the Cloud Data Loader, begin a new Insert operation. There are several ways to start a new Insert:

  • In the Getting Started tab, click the Insert button.
  • In the Project Explorer under Data Operations, expand Inserts and double-click on New Insert....
  • Click the Wizard Wand icon and select Insert.
  • Go to File > New > Jitterbit Connect > New Insert.

Enter Salesforce Credentials

After beginning a new Insert, you will be brought to the Login screen.

  1. Enter your Salesforce credentials.

    NOTE: Your Salesforce credentials will prepopulate if you have already saved the connection details within the Cloud Data Loader.
  2. Click Test Salesforce Login to confirm you have a successful connection.
  3. Click Next to continue.

Select Salesforce Object

You should now be on the Object screen.

  1. Under Select The Salesforce Object, select the type of object within Salesforce that you want to insert. The object may be standard within Salesforce or custom-defined.

    EXAMPLE: In the example, we use the standard Salesforce object Document because we want to upload document files to Salesforce.

  2. Click Next to continue.

Set Source Location

You should now be on the Source screen.

  1. First, you need to create a CSV file that contains a list of "file names" of the files you want uploaded.

    EXAMPLE: In the example, we have four images in a folder called TEST located on the C drive of the local machine. To generate the CSV, we have copied the file names into Notepad and saved the file as book1.csv.

  2. Under Select Where Your Source Data Comes From, specify the location where you saved your CSV file with the names of the files you want to upload.

    EXAMPLE: In the example, we created our CSV file in a folder called TEST located on the C drive of the local machine. So we choose Local File in the dropdown and browse to C:/TEST/book1.csv.

  3. Click Next to continue.
  4. You may see a prompt showing the contents of the selected file. If correct, click Continue.

    NOTE: This prompt appears only the first time the file is used. 
  5. Under Select File Type, select the type of source file you created. Here you can specify whether the file has a header, if it's a single-column file, or if the file has multiple columns that are delimited.

    EXAMPLE: In the example, our book1.csv is a single column and does not have a header, so we choose CSV file, without header.
  6. Click Next to continue.

Define Schedule and Options

You should now be on the Schedule screen.

  1. Under Schedule & Options, use the dropdown to select None for no schedule or Create New... to define schedule parameters.

    EXAMPLE: The example is for a one-time upload, so we will select None.

  2. Click Map & Finish to complete the insert setup.

Map Fields within the Transformation

You should now see two tabs: Inserts and Transformations.

  • The Inserts tab provides a summary of all the elements you just defined with the Insert Wizard. If you need to change any, you can do so here by clicking Edit next to the line you want to change.
  • The Transformations tab shows the mapping of fields from the Source to Target. You will need to configure these before running the insert operation. The mapping process is described below.

Within the Transformations tab, complete the steps below to map the fields from your Source (left side) to the Target (right side): 

  1. Click and drag the Source side file name field to both the Body field and the Name field in the Target side. 

    EXAMPLE: In the example, our Source field is labeled F1 by default. If your source file contained column headers, you should use the field with the name of the file to map to the Target fields Body and Name.

  2. Next, you need to define the specific field within Salesforce that you want to upload to.

    EXAMPLE: In the example, we want to upload our files to a Salesforce folder, so we need to define the ID of the specific folder we want to upload to.
    1. To find the specific folder ID, web browse to your desired target folder within Salesforce. The last 15 characters in the URL is the folder ID.

      NOTE: This is a quick method to find the 15-character short ID. If you ever need the 18-character long ID, a query for finding this is used as an example in Running a Salesforce Query in Data Loader

    2. Double-click on the FolderId field on the Target side to open the Formula Builder window.

    3. In the Formula Builder, clear the script from the formula box and input the specific folder ID obtained above. Then click OK.

  3. Optional: If you included other columns in your source CSV file, you should also map or define these fields at this time.

  4. When complete, click Finish to save the Transformation.

Define Source of the Upload

Next, you will need to define where the files you want to upload are located. To do this, you need to create a new Connection.

  1. In the Project Explorer under Connections, right-click on Sources and select New Source.
  2. In the popup, select the type of location where the files you want to upload are, then click Continue.

    EXAMPLE: In the example, we chose Local File because the files are on the local machine.

  3. Name your source and fill out the fields for your source location. 

    EXAMPLE: In the example, we've specified the local file path where our files are located. In the Get Files box, we've used wildcards in order to get all files in the source location.

Adjust Mapping to Include Source

With the source of the files now defined, there are some adjustments to make within the mapping.

  1. Go to the Inserts tab or reopen the tab by double-clicking your insert in the Project Explorer. Next to Mappings, click the Edit button.

  2. Double-click on the Body field on the Target side to open the Formula Builder.

  3. Highlight the data inside the <trans> and </trans>. Then within the Functions tab below, expand Cryptography and double-click on Base64EncodeFile.

    NOTE: Base64EncodeFile allows us to take binary data and convert it to ASCII for submission to Salesforce.

  4. In the popup window, select the Source you defined with the location of the files you want to upload and click OK.

    EXAMPLE: In the example, we named our Source "Test," so this is the one we choose. This is not the CSV file with the names of the files.

  5. The script should now display the specific Source you defined. Now highlight the "..." within the script and double-click the field where the file name is located. Then click OK.

    EXAMPLE: In the example, the default name was F1, so this is the field we use.

Run the Operation

The Insert operation should now be fully set up and ready to run.

  1. Return to the Inserts tab and click Run Insert.

  2. If the operation is successful, you should see a popup summarizing the results. You can click View success file to see more detail.

  3. You can also browse to the target Salesforce folder to see the files you have uploaded.

On This Page

Related Topics

Last updated:  Apr 19, 2019