August 15, 2023

tSalesforceConnection – Docs for ESB 6.x

tSalesforceConnection

Opens a connection to a Salesforce.

tSalesforceConnection opens a
connection to a Salesforce system in order to carry out a
transaction.

tSalesforceConnection Standard properties

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

The Standard
tSalesforceConnection 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.

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.

Advanced settings

Salesforce URL

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

Bulk Connection

Select this check box if you need to use bulk data processing function.

Use or save the connection session

Select this check box and in the Session directory field
displayed, specify the path to the connection session file to be saved or
used.

This session file can be shared by different Jobs to retrieve a connection
session as long as the correct user ID is provided by the component. This way,
you do not need to connect to the server to retrieve the session.

When an expired session is detected, if the correct connection information (the
user ID, password, and security key) is provided, the component will connect to
the server to retrieve the new session information and update the connection
session file.

This check box is available only when Basic is selected
from the Connection type drop-down list.

Need compression

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

Trace HTTP message

Select this check box to output the HTTP interactions on the console.

This check box is available only when the Bulk Connection check box is selected.

Use HTTP Chunked

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

This check box is available only when the Bulk Connection check box is cleared.

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.

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.

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

ERROR_MESSAGE

The error message generated by the component when an error occurs. This
is an After variable and it returns a string.

Usage

Usage rule

This component is more commonly used with other Salesforce
components.

Limitation

Due to license incompatibility, one or more JARs required to use this component are not
provided. You can install the missing JARs for this particular component by clicking the
Install button on the Component tab view. You can also find out and add all missing JARs easily on the
Modules tab in the
Integration
perspective of your
studio. You can find more details about how to install external modules in Talend Help Center (https://help.talend.com).

Scenario: Using OAuth2 to log in to Salesforce.com

In this scenario, the OAuth2 (Open Authorization 2.0)
method is adopted to authorize tSalesforceConnection to
access the Salesforce.com resources. This way, better security is achieved as users do not
need entering their Salesforce username/password directly on tSalesforceConnection, which is required by the Basic login type instead.

use_case_tsalesforceconnection_1.png

Setting up the Job

  1. Drop a tSalesforceConnection component, a
    tFixedFlowInput component and a tSalesforceOutput component onto the
    workspace.
  2. Link the tFixedFlowInput component to the
    tSalesforceOutput component using a
    Row > Main
    connection.
  3. Link the tSalesforceConnection component to
    the tFixedFlowInput component using a Trigger > OnSubjobOk
    connection.

Configuring the components

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

    use_case_tsalesforceconnection_2.png

  2. In the Connection type list, select OAuth.

    In the Client Id and Client Secret fields, enter the key and secret used by the
    consumer to access Salesforce respectively.
    In the Callback Host and Callback Port fields, enter the callback host and
    port information respectively.
    In the Token File field, browse to or enter
    the path to the token file that stores the refresh token used by the
    OAuth-enabled connected app to obtain new sessions without requiring the user to
    provide their credentials.
  3. Double-click the tFixedFlowInput component to
    open its Basic settings view.

    use_case_tsalesforceconnection_3.png

  4. Click the […] button next to Edit schema and in the pop-up schema dialog box,
    define the schema by adding one column Name
    of String type.

    use_case_tsalesforceconnection_14.png

    Click OK to save the changes and close the
    dialog box.
  5. In the Mode area, select Use Inline Content (delimited file). Then in the
    Content field displayed, enter the data to
    be written into Salesforce. For example,

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

    use_case_tsalesforceconnection_4.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.
  8. 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.

    use_case_tsalesforceconnection_13.png

  9. Click the […] button next to Edit schema to open the schema dialog box.

    use_case_tsalesforceconnection_5.png

    On the right side of the panel, remove all the columns except the Name column.
    Click OK to save the changes and close the
    dialog box.

Executing the Job

  1. Press Ctrl + S to save the Job.
  2. Press F6 to run the Job. The Studio console
    gives the URL (in yellow) for OAuth authorization.

    use_case_tsalesforceconnection_8.png

  3. Copy the URL to the browser’s address bar. The Salesforce.com login page
    appears.

    use_case_tsalesforceconnection_9.png

  4. Fill up the username and password and click Log in to
    Salesforce
    .

    The authorization response is then shown on the browser at the callback
    host.
    use_case_tsalesforceconnection_10.png

  5. Now is the time for the Job to continue running.

    use_case_tsalesforceconnection_11.png

    As shown above, the Job is successfully executed.
  6. Go to the Salesforce.com and check the Account object. You can find that the
    account whose name is Talend is
    inserted.

    use_case_tsalesforceconnection_12.png


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