I have these two queries, to fetch Contact info:

SELECT  Id, FirstName, LastName, Email FROM Contact 
  WHERE Id IN (SELECT ContactId FROM AccountContactRelation 
                WHERE AccountId = '0012o00002RGvUCAA1' AND isDirect=false) 

And to fetch related to that Contact ContactRole from AccountContactRelation

SELECT Roles FROM AccountContactRelation 
  WHERE ContactId ='0032o00002Rp1E9AAJ' AND  AccountId = '0012o00002RGvUCAA1'

Is there a way to combine these two into one query, to have a collection of objects with full contact data including roles? Or if not, how can I combine their results so that it'd be possible to use them from my LWC?


Your Answer

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

Browse other questions tagged or ask your own question.