Get a list of a salesforce lookup

Highlighted
Six Stars

Get a list of a salesforce lookup

Good morning!!

 

I'm have the following requirement: I need to get a list of records or a list of a determinate field in that records.

 

I have the main record (example: account) and the lookup record in talend (ex: contacts), I need to get a list with a contact field: 

 

Example: 

 

Account: Id: A1

               Name: Talend

 

Contact:

              Account: A1

              Id: C1

              Name: Jorge

              Age: 25

 

 

              Account: A1

              Id: C2

              Name: Anna

              Age: 29

 

 

              Account: A1

              Id: C3

              Name: Jaime

              Age: 28

 

And after the tMap I need something like that:

 

Out: 

        Account Name: Talend

        Ages: 25, 29, 28

 

 

Thank you so much!!

I appreciate ur help!

Jorge

 


Accepted Solutions
Fifteen Stars TRF
Fifteen Stars

Re: Get a list of a salesforce lookup

Use the tMap as usually, then using tAggregateRows with a List operation you'll get the expected reseult


TRF

All Replies
Fifteen Stars TRF
Fifteen Stars

Re: Get a list of a salesforce lookup

In your tSalesforceInput component, use your own query like this one:

SELECT Account.Id, Id, Name, Age__c from Contact

The associated schema must match excatly with the fields of the query with any "." replaced by an "_":

Account_Id
Id
Name
Age__c

Hope this helps.

 


TRF
Six Stars

Re: Get a list of a salesforce lookup

Hi TRF,

 

Thanks for your answer.

 

I already have the match done in the tMap. The problem is that the main object is account, so I do the lookup in contact, and like I have three contact that match the criterion I can just choose the first contact, the last one... something like this:

out: 

        Account Name: Talend

        Ages: 25

 

But I would like to get a list like this one:

 

out:

        Account Name: Talend

        Ages: 25, 29, 28

 

Thank you.

Jorge

Fifteen Stars TRF
Fifteen Stars

Re: Get a list of a salesforce lookup

Can you share your query?


TRF
Six Stars

Re: Get a list of a salesforce lookup

I'm not using the query mode, I mean I just get all the accounts and all the contacts in the tSalesforceInput, and then in the tMap I do the lookup, writing in the contact filed AccountId this: Account.Id ( where Account is the row1), so I do the filter or lookup later, in the tMap.

 

Thx

Jorge

Fifteen Stars TRF
Fifteen Stars

Re: Get a list of a salesforce lookup

Use the tMap as usually, then using tAggregateRows with a List operation you'll get the expected reseult


TRF
Six Stars

Re: Get a list of a salesforce lookup

Thank you so much!! Smiley Happy

 

It worked!!

 

Jorge

Six Stars

Re: Get a list of a salesforce lookup

 

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog