tSalesforceOutput
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 available in all Talend
products.
Basic settings
Property Type |
Select the way the connection details
This property is not available when other connection component is selected |
Connection Component |
Select the component that opens the database connection to be reused by this |
Connection type |
Select the type of the connection from the drop-down list. The
|
User Id |
The Salesforce username. This property is available |
Password |
The Salesforce password associated with the username. This property is available |
Security Token |
The Salesforce security token. For more information, see Reset Your Security Token. This property is available |
Issuer |
The OAuth Consumer Key, generated This property is available only |
Subject |
The Salesforce username. This property is available only |
Audience |
Json Web Token audience. You can set your own Json Web Token This property is available only |
Expiration time (in seconds) |
The expiration time of the assertion (in seconds) within five This property is available only |
Key store |
The path to the keystore file in Java Keystore (JKS) format. The keystore file can be generated by creating a certificate signed by This property is available only |
Key store password |
The keystore password. This property is available only |
Certificate alias |
The unique name of the certificate signed by Salesforce. This property is available only |
Client Id |
The OAuth Consumer Key, generated This property is available |
Client Secret |
The OAuth Consumer Secret, generated when your connected app is This property is available |
Callback Host |
The host value in the OAuth authentication callback URL that is This property is available |
Callback Port |
The port value in the OAuth authentication callback URL that is This property is available |
Token File |
The path to the token file that stores the refresh token used to get This property is available |
Module Name |
Click the […] button next to |
Schema and Edit schema |
A schema is a row description. It defines the number of fields Click Edit
Click Sync This This dynamic schema feature is designed for the purpose of |
Output Action |
Select one of the following operations to be performed from the
|
Advanced settings
Salesforce URL |
The Webservice URL required to connect to Salesforce. |
API version |
The Salesforce API version. This property is available only when the |
Use or save the connection |
Select this check box and in the Session This session file can be shared by different Jobs to retrieve a When an expired session is detected, if the correct connection This property is available |
Need compression |
Select this check box to activate SOAP message compression, which can |
Use Http Chunked |
Select this check box to use the |
Client Id |
Enter the ID of the real user to differentiate between those who use |
Timeout |
Enter the intended number of query timeout in milliseconds in |
Use Proxy |
Select this check box to use a proxy server, and in the Host, Port, |
Relationship mapping for |
Click the
This property is |
Extend Insert |
Select this check box to transfer the output data in batches. |
Die on Error |
Select the check box to stop the execution of the Job when an error This check box is cleared by default, meaning to skip the row on error and to |
Retrieve Id |
Select this check box to allow Salesforce to return the This check box is available only when When this check box is selected and the
|
Ignore Null |
Select this check box to ignore NULL values. This property |
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 |
Global Variables
NB_LINE |
The number of rows processed. 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 |
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 |
Usage
Usage rule |
This component can be used as an end |
Upserting Salesforce data based on external IDs
relationship with external IDs of the Account object.
The Job used in this example is composed of the following seven subJobs:
-
the first subJob opens a connection to Salesforce,
-
the second subJob deletes some Account records based on external IDs,
-
the third subJob inserts two Account records with external IDs,
-
the fourth subJob inserts three Contact records based on the mapping relationship with
the Account object external IDs, and gathers both inserted and erroneous data, -
the fifth subJob updates two inserted Contact records based on the mapping relationship
with the Account object external IDs, -
the sixth subJob retrieves the inserted Accout records, and
-
the seventh subJob retrieves the upserted Contact records.
Creating a Job for upserting Salesforce data based on external IDs
-
An external ID custom field Account_External_ID has
been added for the Account object in your Salesforce, which will be used to
map the relationship with the Contact object. -
An external ID custom field Contact_Talend_ID has been
added for the Contact object in Salesforce, which will be used as the key
column for upserting Contact object data.
-
Create a new Job and add a tSalesforceConnection
component, three tSalesforceInput components, four
tSalesforceOutput components, three
tFixedFlowInput components, and four
tLogRow components. -
Connect the first tSalesforceInput component to the
first tSalelsforceOutput component using a Row > Main connection. -
Do the same to connect the first tFixedFlowInput
component to the second tSalesforceOutput component, the
second tFixedFlowInput component to the third
tSalesforceOutput component, the third
tFixedFlowInput component to the fourth
tSalesforceOutput component, the second
tSalesforceInput component to the third
tLogRow component, and the third
tSalesforceInput component to the fourth
tLogRow component. -
Connect the third tSalesforceOutput component to the
first tLogRow component using a Row > Main connection and to the second tLogRow
component using a Row > Reject connection. -
Connect the tSalesforceConnection component to the first
tSalesforceInput component using a Trigger > On Subjob Ok connection. -
Do the same to connect the first tSalesforceInput
component to the first tFixedFlowInput component, the
first tFixedFlowInput component to the second
tFixedFlowInput component, the second
tFixedFlowInput component to the third
tFixedFlowInput component, the third
tFixedFlowInput component to the second
tSalesforceInput component, and the second
tSalesforceInput component to the third
tSalesforceInput component.
Opening a connection to Salesforce
-
Double-click the tSalesforceConnection component to open
its Basic settings view on the
Component tab. -
Select Basic from the Connection
type drop-down list to connect to Salesforce using your
Salesforce account username, password, and security token.In this example, you connect to Salesforce using the basic connection type.
You can also connect to Salesforce using the OAuth JWT (JSON Web Token) Flow
type. For more information, see the related description of how to
connect to Salesforce using OAuth JWT Flow on Talend Help Center (https://help.talend.com). -
In the User Id field, enter your Salesforce
username. -
Click the […] button next to the
Password field and in the pop-up dialog box, enter
your Salesforce password between double quotation marks. -
Click the […] button next to the Security
Token field and in the pop-up dialog box, enter your Salesforce
security token between double quotation marks.You can use the Salesforce metadata wizard to create a connection to your
Salesforce system, save the connection in the Repository, and then reuse the
connection configuration defined in the metadata wizard in Salesforce
components. For more information, see the related description of
centralizing Salesforce metadata.
Deleting Salesforce Account records based on external ID
-
Double-click the first tSalesforceInput component to
open its Basic settings view on the
Component tab. -
Select the component that will create the Salesforce connection from the
Connection Component drop-down list,
tSalesforceConnection_1 in this example. -
Click the […] button next to the Module
Name field and in the pop-up dialog box, select the object whose
data will be deleted, Account in this example. The schema
of the Account object will be automatically filled. -
Click OK to save the changes and in the pop-up dialog
box, click Yes to propagate the schema to the next
tSalesforceOutput component. -
Select Query from the Query Mode
drop-down list and specify the condition used to filter data to be deleted. In
this example, it is talendlena__Account_External_ID__c like
'%talend%'.All Salesforce Account records whose
talendlena__Account_External_ID__c field contains
talend will be deleted. -
Double-click the first tSalesforceOutput component to
open its Basic settings view on the
Component tab. -
Select the component that will create the Salesforce connection from the
Connection Component drop-down list,
tSalesforceConnection_1 in this example. -
Click the […] button next to the Module
Name field and in the pop-up dialog box, select the object whose
data will be deleted, Account in this example. -
Select DELETE from the Output
Action drop-down list to perform the delete operation on the
Account objects filtered by the first tSalesforceInput
component.
Inserting Salesforce Account records with external IDs
-
Double-click the second tSalesforceOutput component to
open its Basic settings view on the
Component tab. -
Select the component that will create the Salesforce connection from the
Connection Component drop-down list,
tSalesforceConnection_1 in this example. -
Click the […] button next to the Module
Name field and in the pop-up dialog box, select the object into
which data will be inserted, Account in this example. The
schema of the Account object will be automatically filled. -
Click the […] button next to Edit
schema and in the pop-up dialog box, remove all schema columns
except the two columns Name and
talendlena__Account_External_ID__c. Then click to copy these two
columns to the first tFixedFlowInput component. When
done, click OK to close the dialog box. -
Select INSERT from the Output
Action drop-down list. -
Double-click the first tFixedFlowInput component to open
its Basic settings view on the
Component tab. -
In the Mode area, select Use Inline
Table and in the table displayed, enter the data to be inserted
into the Salesforce Accout object. In this example, the following two records
will be inserted.12account_talend;account_talend_exidaccount_talend_doc;account_talend_doc_exidYou can also select Use Inline Content, and then copy
and paste the input data into the Content field
displayed.
Inserting Salesforce Contact records upon Account external IDs
-
Double-click the third tSalesforceOutput component to
open its Basic settings view on the
Component tab. -
Select the component that will create the Salesforce connection from the
Connection Component drop-down list,
tSalesforceConnection_1 in this example. -
Click the […] button next to the Module
Name field and in the pop-up dialog box, select the object into
which data will be inserted, Contact in this example. The
schema of the Contact object will be automatically filled. When done, click
OK to save the changes and in the pop-up dialog box,
click Yes to propagate the schema to the next two
tLogRow components. -
Click the […] button next to Edit
schema and in the pop-up dialog box, remove all schema columns
except the three columns LastName,
FirstName, and
talendlena__Contact_Talend_ID__c. Then add another
column Account_External_ID of String type and copy these
four columns to the second tFixedFlowInput component.
When done, click OK to close the dialog box and in the
pop-up dialog box, click Yes to propagate the schema to
the next two tLogRow components. -
Select UPSERT from the Output
Action drop-down list and
talendlena__Contact_Talend_ID__c from the
Upsert Key Column drop-down list displayed. -
Go to the Advanced settings view and in the
Relationship mapping for upsert table, specify the
relationship mapping for the column Account_External_ID
by adding one row and setting the value for each table column. In this example,
the column Account_External_ID is mapped with the
external ID field talendlena__Account_External_ID__c of
the Account object, so the value for Column name of Talend
Schema is Account_External_ID, the value
for Lookup relationship field name and Module
name is Account, and the value for
External id name is
talendlena__Account_External_ID__c. -
Clear the Extend Insert and Die on
Error check boxes so that erroneous data can be gathered via the Row > Reject connection. -
Double-click the second tFixedFlowInput component to
open its Basic settings view on the
Component tab. -
In the Mode area, select Use Inline
Table and in the table displayed, enter the data to be inserted
into the Salesforce Contact object. In this example, the input data is as
follows.123Beckham;David;2018010001;account_talend_exidTaylor;Swift;2018010002;account_talend_exid;;2018010003;account_talend_exidYou can also select Use Inline Content, and then copy
and paste the input data into the Content field
displayed. -
Double-click the first tLogRow component and on its
Basic settings view, select
Table in the Mode area to
display the result in a table. -
Do the same to configure the second tLogRow
component.
Updating Salesforce Contact records upon Account external IDs
-
Double-click the fourth tSalesforceOutput component to
open its Basic settings view on the
Component tab. -
Select the component that will create the Salesforce connection from the
Connection Component drop-down list,
tSalesforceConnection_1 in this example. -
Click the […] button next to the Module
Name field and in the pop-up dialog box, select the object into
which data will be inserted, Contact in this example. The
schema of the Contact object will be automatically filled. -
Click the […] button next to Edit
schema and in the pop-up dialog box, remove all schema columns
except the three columns Phone,
Email, and
talendlena__Contact_Talend_ID__c. Then add another
column Account_External_ID of String type and copy these
four columns to the second tFixedFlowInput component.
When done, click OK to close the dialog box. -
Select UPSERT from the Output
Action drop-down list and
talendlena__Contact_Talend_ID__c from the
Upsert Key Column drop-down list displayed. -
Go to the Advanced settings view and in the
Relationship mapping for upsert table, specify the
relationship mapping for the column Account_External_ID
by adding one row and setting the value for each table column. In this example,
the column Account_External_ID is mapped with the
external ID field talendlena__Account_External_ID__c of
the Account object, so the value for Column name of Talend
Schema is Account_External_ID, the value
for Lookup relationship field name and Module
name is Account, and the value for
External id name is
talendlena__Account_External_ID__c. -
Double-click the third tFixedFlowInput component to open
its Basic settings view on the
Component tab. -
In the Mode area, select Use Inline
Table and in the table displayed, enter the data used to update
the two records inserted into the Salesforce Contact object. In this example,
the updated data is as follows. The phone and email values will be added for
both two records and the Account external ID value for the second record is
updated to account_talend_doc_exid.12+86 13666666666;beckham.david@talend.com;2018010001;account_talend_exid+86 13888888888;taylor.swift@talend.com;2018010002;account_talend_doc_exidYou can also select Use Inline Content, and then copy
and paste the input data into the Content field
displayed.
Retrieving inserted Salesforce Account records
-
Double-click the second tSalesforceInput component to
open its Basic settings view on the
Component tab. -
Select the component that will create the Salesforce connection from the
Connection Component drop-down list,
tSalesforceConnection_1 in this example. -
Click the […] button next to the Module
Name field and in the pop-up dialog box, select the object from
which data will be retrieved, Account in this example.
The schema of the Account object will be automatically filled. -
Click the […] button next to Edit
schema and in the pop-up dialog box, remove all schema columns
except the three columns Id, Name,
and talendlena__Account_External_ID__c. When done, click
OK to save the changes and in the pop-up dialog box,
click Yes to propagate the schema to the next
tLogRow component. -
Select Query from the Query Mode
drop-down list and specify the condition used to filter data to be retrieved. In
this example, it is Name like '%talend%'.All Salesforce Account records whose Name field
contains talend will be retrieved. -
Double-click the third tLogRow component and on its
Basic settings view, select
Table in the Mode area to
display the result in a table.
Retrieving updated Salesforce Contact records using SOQL query
-
Double-click the third tSalesforceInput component to
open its Basic settings view on the
Component tab. -
Select the component that will create the Salesforce connection from the
Connection Component drop-down list,
tSalesforceConnection_1 in this example. -
Click the […] button next to the Module
Name field and in the pop-up dialog box, select the object from
which data will be retrieved, Contact in this example.
The schema of the Contact object will be automatically filled. -
Click the […] button next to Edit
schema and in the pop-up dialog box, remove all schema columns
except the four columns Name,
Phone, Email, and
talendlena__Contact_Talend_ID__c. -
Add another two columns to retrieve name and external ID of the linked Account
object, Contact_Account_Name and
Contact_Account_talendlena__Account_External_ID__c in
this example.To retrieve data of a linked object column, it is necessary to define the
name of the column in a particular manner in the schema editor. The correct
syntax isNameofCurrentObject_NameofLinkedObject_NameofColumnofInterest
.
If this syntax is not respected, data from the linked object will not be
returned. For more information about how to set schema for the relationship
query, see How to set schema for the guess query feature of tSalesforceInput. -
Click OK to save the changes. In the pop-up dialog box,
click Yes to propagate the schema to the next
tLogRow component. -
Select Query from the Query Mode
drop-down list. -
Select the Manual Query check box and click the
Guess query button to generate the SOQL query based
on the defined module name and schema columns. The generated SOQL query will
look like below.12SELECT Name, Phone, Email, talendlena__Contact_Talend_ID__c,Contact.Account.Name, Contact_Account_talendlena__Account_External_ID__c FROM Contact -
In the generated SOQL query string, replace each underscore character after the
object name in the column name
Contact_Account_talendlena__Account_External_ID__c
with a dot character. Then add the WHERE condition clause used to filter data to
be retrieved at the end of the generated SOQL query. In this example, it is
talendlena__Contact_Talend_ID__c like '201801%' and
all Salesforce Contact records whose
talendlena__Contact_Talend_ID__c field begins with
201801 will be retrieved. The updated SOQL query will
look like below.123SELECT Name, Phone, Email, talendlena__Contact_Talend_ID__c,Contact.Account.Name, Contact.Account.talendlena__Account_External_ID__c FROM ContactWHERE talendlena__Contact_Talend_ID__c like '201801%' -
Double-click the fourth tLogRow component and on its
Basic settings view, select
Table in the Mode area to
display the result in a table.
Executing the Job to upsert Salesforce data based on external ID
- Press Ctrl + S to save your Job.
-
Press F6 to execute your Job.
As shown above, two Account records account_talend and
account_talend_doc are successfully inserted, two
Contact records Beckham David and Taylor
Swift are successfully inserted and updated based on the
mapping relationship with the external IDs in the Account object, and
another Contact record missing the value for the required field
LastName is not inserted.You can also go to the Salesforce website to double-check the Job execution
result.