0

I'm trying to access the value of object 2(LiveText__Conversation_Header__c) from object 1 (Case) and getting error.

Query:

SELECT (SELECT LiveText__EndedTime__c FROM LiveText__Conversation_Header__c), 
    CaseNumber, LS_Contract__r.Name, Account.Name, 
    LS_Contract__r.cllease__Last_Payment_Date__c, FORMAT(LastModifiedDate), Type, Description 
FROM Case

Error:

(SELECT LiveText__EndedTime__c FROM LiveText__Conversation_Header__c) ^ ERROR at Row:1:Column:44 Didn't understand relationship 'LiveText__Conversation_Header__c' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.

3

You need to use the name of the relationship and not the object name.

A simple example would be to - Query the related contact ids of an Account.

In order for this if you execute the below query, it will fail

Select id,(select id from Contact), Name from Account limit 5

The correct one would be

Select id,(select id from Contacts), Name from Account limit 5

If you notice the difference, the 2nd one uses the relationship name which is Contacts. You need to go to the lookup field to find the relationship name and then use the same in your query like I have shown in my example above

2

You need to use the relationship name instead of Object API Name. Replace LiveText__Conversation_Header__c with LiveText__Conversation_Header__r.


You can get the Relationship name by going to LiveText__Conversation_Header__c Object open the Field that is related to Case and there you can find the Relationship name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.