I am trying to fetch the note title, note body as per the related contact ID in one SOQL query as two SOQL queries won't serve the purpose.
In contentNote, We have the note title and note body but don't have the contact information. For contact information, there is contentDocumentLink but contentNote don't share any direct relation with contentDocumentLink.
When I run the below SOQL query in the Developer Console
SELECT Id, Title, TextPreview FROM ContentVersion
WHERE ContentDocumentID IN (SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = '0030H000059CBKAQA4')
It throws below error:
ERROR at Row:2:Column:59 Entity 'ContentDocumentLink' is not supported for semi join inner selects
below query also don't serve the purpose as contentDocument object has note title but don't have the note body.
SELECT ContentDocument.title FROM ContentDocumentLink WHERE LinkedEntityId
= '0030H000059CBKAQA4'
It is really frustrating to get all the details in one query, could someone please suggest if note title, body and contact id can be fetched in a single query
Our purpose is to get all the data and integrate with another system.