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 #:
7 of 7
Last update:
‎09-29-2018 12:13 AM
Updated by:
 
Labels (2)
Comments
Three Stars

I have done exactly how you have shown above but i'm failing to extract the response from the body using txmlerror.jpgmap

Employee

This will not come automatically, you can copy the xml body from tLogRow(just before tXMLMap) save it to a file and import it in tXMLMap

Four Stars

Thank you so much for this. I was into this issue and tired to tinker around to check if its possible but couldnt get it done. Now that i have seen the way you did it, thanks guys
with
regards