August 15, 2023

tSalesforceOutput – Docs for ESB 6.x

tSalesforceOutput

Writes data in an object of a Salesforce database via the relevant Web
service.

tSalesforceOutput Standard properties

These properties are used to configure tSalesforceOutput running in the Standard Job framework.

The Standard
tSalesforceOutput component belongs to the Business and the Cloud families.

The component in this framework is generally available.

Basic settings

Property Type

Select the way the connection details
will be set.

  • Built-In: The connection details will be set
    locally for this component. You need to specify the values for all
    related connection properties manually.

  • Repository: The connection details stored
    centrally in Repository > Metadata will be reused by this component. You need to click
    the […] button next to it and in the pop-up
    Repository Content dialog box, select the
    connection details to be reused, and all related connection
    properties will be automatically filled in.

This property is not available when other connection component is selected
from the Connection Component drop-down list.

Connection Component

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.

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.

This component offers the
advantage of the dynamic schema feature. This allows you to retrieve unknown columns
from source files or to copy batches of columns from a source without mapping each
column individually. For further information about dynamic schemas, see
Talend Studio

User Guide.

This dynamic schema
feature is designed for the purpose of retrieving unknown columns of a table and is
recommended to be used for this purpose only; it is not recommended for the use of
creating tables.

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

The Extend Insert check box needs to be cleared when
using the Row > Reject link to collect the erroneous rows.

Retrieve Id

Select this check box to allow Salesforce.com to return the
Salesforce ID for the inserted or updated records.

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

When this check box is selected and the
tSalesforceOutput component is linked to another
component via a Row > Main connection, the following column(s) will be added to the schema
of the data flow:

  • salesforce_id: the Salesforce ID of the created or
    updated record.

  • salesforce_upsert_status (only for
    UPSERT): the status of the upsert action to
    indicate whether the record is created or updated.

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

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

Usage rule

This component can be used as an end component
or an intermediate component of a Job or Subjob and it always needs an input link.

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.

components-tsalesforceoutput_s1_job.png

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.

    components-tsalesforceoutput_s1_tsalesforceconnection.png

  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.

    Use_Case_tSalesforceOutput2.png

  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.

    Use_Case_tSalesforceOutput3.png

  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.

    components-tsalesforceoutput_s1_result.png

    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.

use_case_tsalesforceoutput_4.png

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

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.

    use_case_tsalesforceoutput_5.png

  2. In the File name/Stream field, browse to or
    enter the path to the source file. In this example, it is D:/SalesforceAccount.txt.

    In the Header field, type in 1 to skip the header row in the beginning of the
    file.
  3. Click the […] button next to Edit schema and in the pop-up schema dialog box,
    define the schema by adding four columns Name,
    ParentId, Phone and
    Fax of String type.

    components-tsalesforceoutput_s2_schema.png

    Click OK to save the changes and close the
    dialog box.
  4. Double-click the tSalesforceOutput component
    to open its Basic settings view.

    use_case_tsalesforceoutput_6.png

  5. In the User Id, Password and Security Key
    fields, enter the user authentication information required to access
    Salesforce.
  6. 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.

    components-tsalesforceoutput_s2_selectobject.png

    Click OK to save the settings and close the
    dialog box.
  7. Click Sync columns to retrieve the schema
    from the preceding component and accept the propagation prompted by the pop-up
    dialog box.
  8. Double-click the first tLogRow component to
    open its Basic settings view.

    use_case_tsalesforceoutput_7.png

    In the Mode area, select Table (print values in cells of a table) for better
    readability of the result.
  9. Do the same to configure the second tLogRow
    component.

Executing the Job

  1. Press Ctrl + S to save the Job.
  2. Press F6 to run the Job.

    use_case_tsalesforceoutput_8.png

    As shown above, two records with incorrect ParentId values are rejected and displayed in the tLogRow_2 table on the console.

Scenario 3: Inserting the Account ID values from an Excel File into the Salesforce
Contact object

In this scenario, the Account ID values from an Excel file are inserted into the
Salesforce Contact object based on the matching of the
LastName and Name
fields.

use_case_tsalesforceoutput_9.png

Setting up the Job

  1. Create a new Job and add a tFileInputExcel
    component, a tSalesforceInput component, a
    tMap component and a tSalesforceOutput component by typing their names on the design
    workspace or dropping them from the Palette.
  2. Link the tFileInputExcel component to the
    tMap component using a Row > Main
    connection.
  3. Link the tSalesforceInput component to the
    tMap component using a Row > Main
    connection. The connection is automatically changed to a Lookup flow.
  4. Link the tMap component to the tSalesforceOutput component using a Row > *New Output*
    (Main)
    connection. In the pop-up dialog box, enter the name of
    the output connection. In this example, it is out.

Configuring the components

Configuring the source Excel input

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

    use_case_tsalesforceoutput_10.png

  2. In the File name/Stream field, browse to or
    enter the path to the Excel file that contains the Account ID data to be
    inserted. In this example, it is D:/AccountIdInput.xls. And the content of the file is as
    follows:

    use_case_tsalesforceoutput_11.png

  3. Select the All sheets check box to retrieve
    the data of the entire Excel file.
  4. In the Header field, enter 1 to skip one row in the beginning of the
    file.
  5. Click the […] button next to Edit schema and in the pop-up schema dialog box,
    define the schema by adding three columns AccountId, LastName and
    Name of String type.

    use_case_tsalesforceoutput_12.png

    Click OK to save the settings and close the
    dialog box.

Configuring the destination object and the desired operation

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

    use_case_tsalesforceoutput_15.png

  2. In the User Id, Password and Security Key
    fields, enter the user authentication information required to access
    Salesforce.
  3. 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 Contact.

Configuring the lookup source and establishing the mapping relations

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

    use_case_tsalesforceoutput_14.png

  2. In the User Id, Password and Security Key
    fields, enter the user authentication information required to access
    Salesforce.
  3. 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 Contact.

    Click OK to save the settings and close the
    dialog box. In the pop-up dialog box, click Yes
    to propagate the schema to the next component.
  4. Double-click the tMap component to open its
    map editor.

    use_case_tsalesforceoutput_13.png

  5. Select the LastName column from the
    row1 table and drop it to its counterpart
    column in the row2 table.

    Do the same to drop the Name column in the
    row1 table to its counterpart column in
    the row2 table.
    This way, the data from the Excel file will be checked against their
    counterparts in the Contact object.
  6. Select the AccountId column from the
    row1 table and drop it to its counterpart
    column in the out table.

    Do the same to drop the LastName column in
    the row1 table to its counterpart column in
    the out table.
    This way, qualified data from the Excel file will be passed to their
    counterpart fields in the out table.
  7. Click OK to close the map editor.

Executing the Job

  1. Press Ctrl + S to save your Job.
  2. Press F6 to run the Job.

    use_case_tsalesforceoutput_16.png

Scenario 4: Upserting the Contact object based on mapping relationships with the external
IDs in the Account object

This scenario upserts the records in the Contact object
based on mapping (matching) against the external IDs in the Account object.

use_case_tsalesforceoutput_4_1.png

Setting up the Job

  1. Create a new Job and add a tSalesforceConnection component, two tFixedFlowInput components, two tSalesforceInput components, two tSalesforceOutput components and two tLogRow components by typing their names on the design workspace
    or dropping them from the Palette.
  2. Link the first tFixedFlowInput component to
    the first tSalesforceOutput component using a
    Row > Main
    connection.
  3. Do the same to link the first tSalesforceInput component to the first tLogRow component, the second tFixedFlowInput component to the second tSalesforceOutput component, and the second tSalesforceInput component to the second tLogRow component.
  4. Link the tSalesforceConnection component to
    the first tFixedFlowInput component using a
    Trigger > OnSubjobOk connection.
  5. Do the same to link the first tFixedFlowInput
    component to the first tSalesforceInput
    component, the first tSalesforceInput component
    to the second tFixedFlowInput component, and
    the second tFixedFlowInput component to the
    second tSalesforceInput component.

Configuring the components

Connecting to Salesforce

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

use_case_tsalesforceoutput_4_2.png

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

Inserting the external ID values into the Account object

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

    use_case_tsalesforceoutput_4_3.png

  2. Click the […] button next to Edit schema and in the pop-up schema dialog box,
    define the schema by adding three columns Name, AccountID__c and
    AccountBizLicense__c of String
    type.

    use_case_tsalesforceoutput_4_4.png

    Note that AccountID__c and AccountBizLicense__c are customized fields in the
    Account object, with the attribute of
    external ID.
    Click OK to save the changes and close the
    dialog box.
  3. In the Mode area, select Use Inline Content (delimited file) and enter the
    data below in the Content field.

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

    use_case_tsalesforceoutput_4_5.png

  5. In the drop-down list next to the Property
    Type
    drop-down list, select the tSalesforceConnection component to reuse the connection created
    by it.
  6. 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.

Retrieving the external ID values from the Account object

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

    use_case_tsalesforceoutput_4_6.png

  2. In the drop-down list next to the Property
    Type
    drop-down list, select the tSalesforceConnection component to reuse the connection created
    by it.
  3. 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.
  4. Click the […] button next to Edit schema and in the pop-up schema dialog box,
    define the schema by adding three columns Name, AccountID__c and
    AccountBizLicense__c of String type, same
    as the schema of the first tFixedFlowInput
    component.

    Click OK to save the changes and close the
    dialog box.
  5. In the Condition field, enter the filter
    statement between double quotation marks. In this example, it is "name
    like 'Tal%' OR name like 'Goo%'"
    .
  6. Double-click the first tLogRow component to
    open its Basic settings view.

    use_case_tsalesforceoutput_4_7.png

    In the Mode area, select Table (print values in cells of a table) for better
    readability of the results.

Upserting the emails into the Contact object upon the external ID
matching

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

    use_case_tsalesforceoutput_4_8.png

  2. Click the […] button next to Edit schema and in the pop-up schema dialog box,
    define the schema by adding four columns Email, AccountBizLicense,
    AccountID and LastName of String type.

    use_case_tsalesforceoutput_4_9.png

    Click OK to save the changes and close the
    dialog box.
  3. In the Mode area, select Use Inline Content (delimited file) and enter the
    data below in the Content field.

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

    use_case_tsalesforceoutput_4_10.png

  5. In the drop-down list next to the Property
    Type
    drop-down list, select the tSalesforceConnection component to reuse the connection created
    by it.
  6. 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 Contact.
  7. Select UPSERT from the Output Action drop-down list, and then Email from the Upsert Key
    Column
    drop-down list.
  8. Go to the Advanced settings view to set the
    relationship mapping.

    use_case_tsalesforceoutput_4_11.png

    Click the [+] button below the Relationship mapping for upsert table to add two
    lines.
    Click the cells under the Column name of Talend
    Schema
    column and from the drop-down list select AccountBizLicense and AccountID respectively.
    Enter the lookup relationship fields in the Lookup field
    name
    column, Account and
    Account__r respectively.
    Enter the lookup module names in the Module
    name
    column, Account for the
    both.
    Enter the external ID fields in the External id
    name
    column, AccountBizLicense__c and AccountID__c respectively, which are the customized fields (with
    the external ID attribute) in the Account
    object.
    Note that Column name of Talend Schema refers
    to the fields in the schema of the component preceding tSalesforceOutput. 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 refers to the lookup relationship
    fields of the module selected from the Module
    list in the Basic settings view. They are
    intended to establish relationship with the lookup module specified in the
    Module name column. For how to define the
    lookup relationship fields and how to provide their correct names in the
    Lookup field name column, go to the
    Salesforce website and launch the Salesforce Data Loader application for proper
    actions and information.

Retrieving the emails from the Contact object

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

    use_case_tsalesforceoutput_4_12.png

  2. In the drop-down list next to the Property
    Type
    drop-down list, select the tSalesforceConnection component to reuse the connection created
    by it.
  3. 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 Contact.
  4. Click the […] button next to Edit schema to open the schema dialog box.

    use_case_tsalesforceoutput_4_13.png

    Remove all columns except LastName and
    Email.
    Click OK to save the changes and close the
    dialog box.
  5. In the Condition field, enter the filter
    statement between double quotation marks. In this example, it is "Email
    like 'And%'"
    .
  6. Double-click the second tLogRow component to
    open its Basic settings view.

    use_case_tsalesforceoutput_4_14.png

    In the Mode area, select the Table (print values in cells of a table) radio button
    for better readability of the results.

Executing the Job

  1. Press Ctrl + S to save the Job.
  2. Press F6 to run the Job.

    use_case_tsalesforceoutput_4_15.png

    As shown above, the insert and upsert actions have been completed
    successfully.

Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x