Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
rpernas1618300500
Contributor II
Contributor II

Query field on related custom object from custom object

I have 2 custom objects related to each other. The first custom object Trial__c has a lookup to custom object OpportunityLineItem2__c.

The lookup is TRI_LKP_Product__c.

I want to get the Name field of OpportunityLineItem2__c by doing a query on Trial__c.

 

To do this, in the metadata that I get from Salesforce I create a variable as indicated in the Talend documentation: 

The correct syntax is NameofCurrentObject_NameofLinkedObject_NameofColumnofInterest

 

The variable I create has the following name:

Trial__c_OpportunityLineItem2__c_Name

0695b00000Eak1rAAB.png 

Then I put a tSalesforceInput and perform a manual query like this:

"SELECT Id, TRI_LKP_Product__r.Name FROM Trial__c"

 

Then I connect the tSalesforceInput to a tLogRow but receive the null value in that field.

0695b00000EajxQAAR.png 

0695b00000EajyJAAR.png 

Could someone tell me what I am doing wrong and could please help me?

Thank you very much in advance!

Labels (3)
1 Solution

Accepted Solutions
rpernas1618300500
Contributor II
Contributor II
Author

Finally I was able to get the fields of the related custom object. The syntax was not correct. The documentation indicates that the syntax should be: 

 

NameofCurrentObject_NameofLinkedObject_NameofColumnofInterest

 

But the correct syntax to make it work is:

 

NameofCurrentObject_NameofFieldInRelationMode_NameofColumnofInterest

 

In my example:

 

Trial__c_TRI_LKP_Product__r_Name

 

Thanks and regards!

View solution in original post

8 Replies
Anonymous
Not applicable

Hello,

Could you please post your whole job design screenshots here? Which will be helpful for us to address your issue.

Best regards

Sabrina

rpernas1618300500
Contributor II
Contributor II
Author

Hi @Xiaodi Shi​ ,

 

I have created a new job with only the tSalesforceInput and the tLogRow and the same thing keeps happening.

0695b00000EawDQAAZ.png0695b00000EawE4AAJ.pngThanks and regards!!

Anonymous
Not applicable

Hello,

Have you tried to verify the salesforce custom object permissions and do this kind of SOQL query to see if there any query result returned via Logging in to the Salesforce workbench?

Best regards

Sabrina

rpernas1618300500
Contributor II
Contributor II
Author

Hi @Xiaodi Shi​ 

Yes, i´ve tried that.

It happens with all custom objects, for example, I have another lookup in Contact that points to another custom object "Dialing_Code__c" and the same thing happens. If I do it with standard objects there is no problem, for example, Contact_Account_Name works fine but if I do it with a custom object it returns nothing.

 

Is the syntax correct?

do you have any example where you do a query with custom objects? 

 

Thanks and regards!

Anonymous
Not applicable

Hello,

Here is a KB article: https://community.talend.com/s/article/Learned-by-Doing-How-to-create-and-use-a-Salesforce-custom-ob...

Let us know if it helps.

Best regards

Sabrina

rpernas1618300500
Contributor II
Contributor II
Author

Hi @Xiaodi Shi​ ,

 

I don't see any relation between my question and the post in the link. In the post there is no query to a related custom object in Salesforce.

 

Thanks and regards!

rpernas1618300500
Contributor II
Contributor II
Author

Finally I was able to get the fields of the related custom object. The syntax was not correct. The documentation indicates that the syntax should be: 

 

NameofCurrentObject_NameofLinkedObject_NameofColumnofInterest

 

But the correct syntax to make it work is:

 

NameofCurrentObject_NameofFieldInRelationMode_NameofColumnofInterest

 

In my example:

 

Trial__c_TRI_LKP_Product__r_Name

 

Thanks and regards!

Anonymous
Not applicable

Hello,

Thanks for letting us know you are able to get the fields of the related custom object and marking this topic as resolved.

Best regards

Sabrina