Extracting Picklists from Salesforce

Overview

This article presents an approach to extracting picklists of objects from Salesforce.

 

Environment

  • Talend Studio – 6.4.1
  • Salesforce Developer Account

 

Set up a connected App in Salesforce

The first step is to set up a connected App in Salesforce so that a connection from Talend can be established.

setup.png

 

The screenshot below presents a sample connected app created for this article—TestWithTalend.TestWithTalend.png

 

Make a note of your Consumer Key and Consumer Secret. These will be needed in the next step.

 

Prepare the Job in Talend

  1. Start Talend Studio and create an Integration Job.

  2. Configure a tRESTClient component to retrieve the OAuth2 token, as shown below.

    tRestClient.png

     

    Here, client_id and client_secret are the Consumer Key and Consumer Secret captured in the last step.

    For username and password, provide your Salesforce account credentials.

  3. Run a test to retrieve the token (access_token).

    retrieve_token.png

    access_token.png

     

  4. As the token will be required at a later stage in the Job, save it as a context variable by leveraging tExtractJSONFields and tJavaRow components as shown below:

    tExtractJSONFields.png

    tJavaRow.png

     

  5. At this step, the partial Job looks like this:

    partial_job.png

  6. Now that the access_token is available, use another tRESTClient component to retrieve the picklists for the Account object. Note the URL, Authentication Type, and Bearer Token.

    Account_object.png

     

  7. Run a test to see the response body.

    Account_response.png

     

  8. The next step is to add a filter to save only picklist types. In this example, tXMLMap was used:

    picklist_filter.png

     

  9. At this stage, the complete operational Job looks like this:

    complete_job.png

     

  10. The sample output (from the tLogRow_1 component) is pasted below for reference, along with a corresponding screenshot from Salesforce for this field:

    sample_output.png

    picklist.png

     

Version history
Revision #:
6 of 6
Last update:
‎09-11-2017 05:10 PM
Updated by:
 
Labels (1)
Contributors
Tags (1)