This scenario describes a six-component Job that transforms .csv data suitable for bulk processing, load them in Salesforce.com and then displays the Job execution results in the console.
This Job is composed of two steps: preparing data by transformation and processing the transformed data.
Before starting this scenario, you need to prepare the input file which offers the data to be processed by the Job. In this use case, this file is sforcebulk.txt, containing some customer information.
Then to create and execute this Job, operate as follows:
Drop tFileInputDelimited, tMap, tSalesforceOutputBulk, tSalesforceBulkExec and tLogRow from the Palette onto the workspace of your studio.
Use a Row > Main connection to connect tFileInputDelimited to tMap, and Row > out1 from tMap to tSalesforceOutputBulk.
Use a Row > Main connection and a Row > Reject connection to connect tSalesforceBulkExec respectively to the two tLogRow components.
Use a Trigger > OnSubjobOk connection to connect tFileInputDelimited and tSalesforceBulkExec.
Double-click tFileInputDelimited to display its Basic settings view and define the component properties.
From the Property Type list, select Repository if you have already stored the connection to the salesforce server in the Metadata node of the Repository tree view. The property fields that follow are automatically filled in. If you have not defined the server connection locally in the Repository, fill in the details manually after selecting Built-in from the Property Type list.
For more information about how to create the delimited file metadata, see Talend Studio User Guide.
Next to the File name/Stream field, click the [...] button to browse to the input file you prepared for the scenario, for example, sforcebulk.txt.
From the Schema list, select Repository and then click the three-dot button to open a dialog box where you can select the repository schema you want to use for this component. If you have not defined your schema locally in the metadata, select Built-in from the Schema list and then click the three-dot button next to the Edit schema field to open the dialog box to set the schema manually. In this scenario, the schema is made of four columns: Name, ParentId, Phone and Fax.
According to your input file to be used by the Job, set the other fields like Row Separator, Field Separator...
Double-click the tMap component to open its editor and set the transformation.
Drop all columns from the input table to the output table.
.toUpperCase()behind the Name column.
Click OK to validate the transformation.
Double-click tSalesforceOutputBulk to display its Basic settings view and define the component properties.
In the File Name field, type in or browse to the directory where you want to store the generated .csv data for bulk processing.
Click Sync columns to import the schema from its preceding component.
Double-click tSalesforceBulkExect to display its Basic settings view and define the component properties.
Use the by-default URL of the Salesforce Web service or enter the URL you want to access.
In the Username and Password fields, enter your username and password for the Web service.
In the Bulk file path field, browse to the directory where is stored the generated .csv file by tSalesforceOutputBulk.
From the Action list, select the action you want to carry out on the prepared bulk data. In this use case, insert.
From the Module list, select the object you want to access, Account in this example.
From the Schema list, select Repository and then click the three-dot button to open a dialog box where you can select the repository schema you want to use for this component. If you have not defined your schema locally in the metadata, select Built-in from the Schema list and then click the three-dot button next to the Edit schema field to open the dialog box to set the schema manually. In this example, edit it conforming to the schema defined previously.
Double-click tLogRow_1 to display its Basic settings view and define the component properties.
Click Sync columns to retrieve the schema from the preceding component.
Select Table mode to display the execution result.
Do the same with tLogRow_2.
Press CTRL+S to save your Job.
Press F6 to execute it.
You can check the execution result on the Run console.
In the tLogRow_1 table, you can read the data inserted into your Salesforce.com.
In the tLogRow_2 table, you can read the rejected data due to the incompatibility with the Account objects you have accessed.
All the customer names are written in upper case.