Retrieving Contact.Email, Opportunity.Name and OpportunityLineItem.Quantity in one query

StackOverflow https://stackoverflow.com/questions/20977145

  •  25-09-2022
  •  | 
  •  

문제

I'm trying to retrieve Contact.Email, Opportunity.Name and OpportunityLineItem.Quantity in a single SOQL query. Is this possible? If so, how?

My query is:

Select Opportunity.Id, Opportunity.Name, Contact.Email, (Select Quantity From OpportunityLineItem) From OpportunityContactRole Limit 10

My main objective is to get elements from OpportunityContactRole and OpportunityLineItem in a single query.

도움이 되었습니까?

해결책

You were close :)

SELECT Id, Name,
    (SELECT Quantity FROM OpportunityLineItems),
    (SELECT Contact.Email FROM OpportunityContactRoles)
FROM Opportunity

다른 팁

You can try something like:

SELECT Opportunity.Name, Contact.Email, Contact.Id FROM OpportunityContactRole WHERE Opportunity.Id = '<OppId>'LIMIT 1
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top