Skip to main content Skip to complementary content
Close announcements banner

Retrieving updated Salesforce Contact records using SOQL query

Procedure

  1. Double-click the third tSalesforceInput component to open its Basic settings view on the Component tab.
  2. Select the component that will create the Salesforce connection from the Connection Component drop-down list, tSalesforceConnection_1 in this example.
  3. 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.
  4. 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.
  5. 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 is NameofCurrentObject_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.

  6. Click OK to save the changes. In the pop-up dialog box, click Yes to propagate the schema to the next tLogRow component.
  7. Select Query from the Query Mode drop-down list.
  8. 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.
    SELECT Name, Phone, Email, talendlena__Contact_Talend_ID__c, 
    Contact.Account.Name, Contact_Account_talendlena__Account_External_ID__c FROM Contact
  9. 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.
    SELECT Name, Phone, Email, talendlena__Contact_Talend_ID__c, 
    Contact.Account.Name, Contact.Account.talendlena__Account_External_ID__c FROM Contact 
    WHERE talendlena__Contact_Talend_ID__c like '201801%'
  10. 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.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!