Talend Tutorials

Uploading Data To Salesforce Com

Uploading Data To Salesforce Com

In this tutorial, we’ll be doing a simple upload to a Salesforce environment to let you get a look on how easy Salesforce integration is in Talend. Though Talend has multiple component options in how to perform your Salesforce loads and Transformations, we’ll stick with simply uploading a .csv file with a few columns of data into Salesforce Accounts.

Step 1: Create Salesforce Metadata

The first requirement of this job is to create a reusable Salesforce connection. The best way to do this is right click on the red Salesforce icon in the Respository and select “Create Salesforce Connection”. If you have a different version of the service, be sure to change the URL to accommodate it. Then enter your Salesforce username and password into their respective text boxes.

Note that you must have a developer account from Salesforce to access the API, and the administrator must have given you API access permissions from your account. The password may also require you to append a security token onto the end of your password to allow access to the API.

Click the “Check Login” button to be sure everything works before saving it.

image 1

After this done, Talend will ask which Salesforce elements you’d like you import the metadata of, and for this example, I simply brought in Account and Contact.

image 2

After clicking finish, this Metadata can be found by expanding the Salesforce icon in the Repository.

image 3

Step 2: Choose your input data

I generated a text document consisting of a Name, Street, City, and State. It has 100 rows of randomly mixed data (you can probably guess the few possible values I used) but it will make due for this particular exercise. The same can be done with any input, such as a MySQL or MS Access database, and its quite simple to do the same transformations and load into Salesforce.

image 4

Step 3: Create File Delimited Metadata

Under the “Repository” right click “File delimited” and select “Create file delimited”. Then select a name for this metadata.

image 5

Next, you are going to want to choose the location of the file on your hard drive, so click the “Browse…” button and select it. Then move to the next page and click “Finish”. The metadata will now be saved in your Repository.

image 6

Step 4: Create Input

Drag the tFileInputDelimited component from the metadata in Repository. You’ll then want to select the component and be sure to name all the fields in the schema, since they didn’t have names in the original file. Just head down to where it says “Schema” and then click “…” by “Edit Schema” at the end of the line.

image 7

Step 5: Map your data

Back in your canvas, drag a tMap from the Palette menu, and lastly drag the “Account” Salesforce metadata from the Repository that we create earlier into the canvas. Then connect all the rows by right clicking each precursory component and selecting Row–>Main and connect it to the next component, as such:

image 8

All that is left to do is map the values to the items they are associated to in Salesforce. Do this by double-clicking your tMap component and opening the Map view. Drag the fields from right to left to match the appropriate output field.

image 9

A quick note that sometimes having NULL fields is not accepted in a Salesforce upload. IsDeleted needs a value to be passed, or to have one set by default.

image 10

To force it to a default value, go to the bottom of the tMap Editor and select the IsDeleted Column and click the red “X” to delete it.That way you aren’t trying to overwrite a value that cannot be NULL.

image 11

A better way to accomplish this may be to simply set IsDeleted to “false” by going to the mapping and manually typing false into its output field.

You’re now ready to run your job.

Step 6: View your data in Salesforce

After opening the run tab and executing your job, head to your Salesforce accounts to view the changes. The Accounts field should be filled up with the information you added.

image 12

This is only the tip of the iceberg for you Salesforce users who may be interested in more, so try it out for yourself.

Looking For More Talend Resources and Help?
Ask An Expert