tSalesforceOutput - 6.3

Talend Open Studio for Big Data Components Reference Guide

EnrichVersion
6.3
EnrichProdName
Talend Open Studio for Big Data
task
Data Governance
Data Quality and Preparation
Design and Development
EnrichPlatform
Talend Studio

Function

tSalesforceoutput writes in an object of a Salesforce database via the relevant Web service.

Purpose

Allows to write data into a Salesforce DB.

tSalesforceOutput Properties

Component family

Business/Cloud

 

Basic settings

Property Type

Either Built-In or Repository.

  • Built-In: No property data stored centrally.

  • Repository: Select the repository file where the properties are stored.

Since version 5.6, both the Built-In mode and the Repository mode are available in any of the Talend solutions.

Connection

Select the component whose connection details will be used to set up the connection.

Connection type

Select the type of the connection from the drop-down list, either Basic or OAuth.

  • Basic: select this option to access Salesforce.com by entering your user ID and password. With this option selected, you need to specify the following properties:

    • User Id: the ID of the user in Salesforce.

    • Password: the password associated with the user ID.

    • Security Key: the security token.

  • OAuth: select this option to access Salesforce.com by entering your consumer key and consumer secret. This way, your user name and password will not be exposed, but extra work is required:

    With this option selected, you need to specify the following properties:

    • Client Id and Client Secret: the OAuth consumer key and consumer secret, which are available in the OAuth Settings area of the Connected App that you have created at Salesforce.com.

    • Callback Host and Callback Port: the OAuth authentication callback URL. This URL (both host and port) is defined during the creation of a Connected App and will be shown in the OAuth Settings area of the Connected App.

    • Token File: the path to the token file that stores the refresh token used to get the access token without authorization.

 

Module Name

Click the [...] button next to the field and in the dialog box displayed, select the module that will be used or select the Use custom object check box and specify the module name in the Object Name field.

Schema and Edit schema

A schema is a row description. It defines the number of fields (columns) to be processed and passed on to the next component. The schema is either Built-In or stored remotely in the Repository.

Since version 5.6, both the Built-In mode and the Repository mode are available in any of the Talend solutions.

Click Edit schema to make changes to the schema. If the current schema is of the Repository type, three options are available:

  • View schema: choose this option to view the schema only.

  • Change to built-in property: choose this option to change the schema to Built-in for local changes.

  • Update repository connection: choose this option to change the schema stored in the repository and decide whether to propagate the changes to all the Jobs upon completion. If you just want to propagate the changes to the current Job, you can select No upon completion and choose this schema metadata again in the [Repository Content] window.

Click Sync columns to retrieve the schema from the previous component connected in the Job.

 

Output Action

Select one of the following operations to be performed from the drop-down list.

  • INSERT: insert one or more new records into Salesforce.

  • UPDATE: update one or more existing records in Salesforce.

  • UPSERT: create new records and update existing records. In the Upsert Key Column field dispalyed, specify the key column for the upsert operation.

  • DELETE: delete one or more records in Salesforce.

Advanced settings

Salesforce URL

Enter the Webservice URL required to connect to the Salesforce database.

 

Need compression

Select this check box to activate SOAP message compression, which can result in increased performance levels.

 

Use HTTP Chunked

Select this check box to use the HTTP chunked data transfer mechanism.

 

Client Id

Enter the ID of the real user to differentiate between those who use the same account and password to access the Salesforce website.

This field is available only when Query is selected from the Query Mode drop-down list.

 

Timeout (milliseconds)

Enter the intended number of query timeout in Salesforce.com.

 

Use Proxy

Select this check box to use a proxy server, and in the Host, Port, User Id, and Password fields displayed, specify the connection parameters of the proxy server.

 

Relationship mapping for upsert

Click the [+] button to add lines as needed and specify the external ID fields in the input flow, the lookup relationship fields in the upsert module, the lookup module as well as the external ID fields in the lookup module.

  • Column name of Talend Schema: the name of the external ID field in the input flow. It refers to the fields in the schema of the preceding component. Such columns are intended to match against the external ID fields specified in the External id name column, which are the fields of the lookup module specified in the Module name column.

  • Lookup field name: the name of the lookup field. It refers to the lookup field of the module specified in the Module Name field in the Basic settings view. This column needs to be specified when there are NULL input values for it and the Ignore Null check box is cleared.

  • Lookup relationship field name: the name of the lookup relationship field. It refers to the lookup relationship fields of the module specified in the Module Name field in the Basic settings view and is intended to establish relationship with the lookup module specified in the Module name column in this table. For how to define the lookup relationship fields and how to provide their correct names in the Lookup relationship field name field, go to the Salesforce website and launch the Salesforce Data Loader application for proper actions and information.

  • Module name: the name of the lookup module.

  • External id name: the name of the external ID field in the lookup module specified in the Module name column.

This table is available only when UPSERT is selected from the Output Action drop-down list.

 

Extend Insert

Select this check box to transfer the output data in batches. In the Commit Level field displayed, specify the number of lines per batch.

 

Cease on Error

Select this check box to stop the execution of the Job when an error occurs.

Clear the check box to skip any rows on error and complete the process for error-free rows. When errors are skipped, you can collect the rows on error using a Row > Reject link.

 

Retrieve Insert Id

Select this check box to allow Salesforce.com to return the salesforce ID produced for a new row that is to be inserted. The ID column is added to the processed data schema in Salesforce.com.

This check box is available only when INSERT is selected from the Output Action drop-down list and the Extend Insert check box is cleared.

 

Ignore Null

Select this check box to ignore NULL values.

This check box is available only when UPDATE or UPSERT is selected from the Output Action drop-down list.

 

Log File Name

Specify the path to the log file that holds all error logs.

 

tStatCatcher Statistics

Select this check box to gather the Job processing metadata at the Job level as well as at each component level.

Global Variables

NB_LINE: the number of rows read by an input component or transferred to an output component. This is an After variable and it returns an integer.

NB_SUCCESS: the number of rows successfully processed. This is an After variable and it returns an integer.

NB_REJECT: the number of rows rejected. This is an After variable and it returns an integer.

ERROR_MESSAGE: the error message generated by the component when an error occurs. This is an After variable and it returns a string. This variable functions only if the Die on error check box is cleared, if the component has this check box.

A Flow variable functions during the execution of a component while an After variable functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl + Space to access the variable list and choose the variable to use from it.

For further information about variables, see Talend Studio User Guide.

Usage

This component is usually used as an end component of a Job or Subjob and it always needs an input link.

Log4j

If you are using a subscription-based version of the Studio, the activity of this component can be logged using the log4j feature. For more information on this feature, see Talend Studio User Guide.

For more information on the log4j logging levels, see the Apache documentation at http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html.

Limitation

n/a

Scenario 1: Deleting data from the Account object in Salesforce

This scenario describes a three-component Job that removes the record added into the Salesforce Account object in Scenario: Using OAuth2 to log in to Salesforce.com.

Setting up the Job

  1. Create a new Job and add a tSalesforceConnection component, a tSalesforceInput component and a tSalesforceOutput component by typing their names on the design workspace or dropping them from the Palette.

  2. Link the tSalesforceInput component to the tSalesforceOutput component using a Row > Main connection.

  3. Link the tSalesforceConnection component to the tSalesforceInput component using a Trigger > OnSubjobOk connection.

Configuring the components

  1. Double-click the tSalesforceConnection component to open its Basic settings view.

  2. In the User Id, Password and Security Key fields, enter the user authentication information required to access Salesforce.

  3. Double-click the tSalesforceInput component to open its Basic settings view.

  4. In the drop-down list next to the Property Type drop-down list, select the tSalesforceConnection component to reuse the connection created by it.

    Click the [...] button next to the Module Name field and in the pop-up dialog box, select the object you want to access. In this example, it is Account.

  5. In the Condition field, enter the condition expression used to filter the record to be deleted between double quotation marks. In this example, it is name='Talend', which is used to filter the account record whose name is Talend.

  6. Double-click the tSalesforceOutput component to open its Basic settings view.

  7. In the drop-down list next to the Property Type drop-down list, select the tSalesforceConnection component to reuse the connection created by it.

    Click the [...] button next to the Module Name field and in the pop-up dialog box, select the object you want to access. In this example, it is Account.

  8. From the Output Action drop-down list, select the operation to be carried out. In this example, select DELETE to delete the Talend account retrieved in the previous component.

Executing the Job

  1. Press Ctrl + S to save the Job.

  2. Press F6 to execute the Job.

  3. Go to the Salesforce.com and check the content of the Account object.

    As shown above, the Talend account has already been deleted from the server.

Scenario 2: Gathering erroneous data while inserting data into a Salesforce object

In this scenario, the account data in a local file SalesforceAccount.txt is inserted into the Salesforce Account object, and both the inserted data and the erroneous data are collected and displayed on the console.

The content of the input file SalesforceAccount.txt is as follows:

Name;ParentId;Phone;Fax
Burlington Textiles Corp of America;;(336) 222-7000;(336) 222-8000
Dickenson plc;; (785) 241-6200;(785) 241-6201
GenePoint;;(650) 867-3450;(650) 867-9895
Edge Communications;talend;(512) 757-6000;(512) 757-9000
Grand Hotels & Resorts Ltd;talend;(312) 596-1000;(312) 596-1500

Setting up the Job

  1. Create a new Job and add a tFileInputDelimited component, a tSalesforceOutput component and two tLogRow components by typing their names on the design workspace or dropping them from the Palette.

  2. Link the tFileInputDelimited component to the tSalesforceOutput component using a Row > Main connection.

  3. Link the tSalesforceOutput component to the first tLogRow component using a Row > Main connection.

  4. Link the tSalesforceOutput component to the second tLogRow component using a Row > Reject connection.

    Note that the Row > Reject connection for the tSalesforceOutput component is available only when the Extend Insert and Cease on error check boxes in the Advanced settings view are cleared.

Configuring the components

  1. Double-click the tFileInputDelimited component to open its Basic settings view.