While crawling object ContentDodumentLink from Salesforce you might come across this issue which is a SOQL limitation on ContentDocumentLink object. the exact error from Coveo Source activity log looks like this:
Implementation restriction: ContentDocumentLink requires a filter by a single Id on ContentDocumentId or LinkedEntityId using the equals operator or multiple Id’s using the IN operator. (MALFORMED_QUERY) -> Failed to GET resource at ‘https://org-url/services/data/v51.0/query/01g79000003Bd2sAAC-1’. [BEGIN RESPONSE BODY][{“message”:”Implementation restriction: ContentDocumentLink requires a filter by a single Id on ContentDocumentId or LinkedEntityId using the equals operator or multiple Id’s using the IN operator.”,”errorCode”:”MALFORMED_QUERY”}][END RESPONSE BODY] -> The remote server returned an error: (400) Bad Request.
this can be handled from Coveo admin console Source config, below are the steps to fix this issue:
Open your Salesforce source config popup:
Click on ContentDocumentLink object on the left-hand side and click Conditions button:
On the next popup, from the first dropdown select ContentDocumentLink ID – Id, from the second select Not equals, and in the input field enter null and LinkedEntityId in (select id from opportunity), where you can replace Opportunity with any other object your ContentDocumentLink is linked to, this will be included in the SOQL condition which will be according to the SOQL limitation, here is how the final query looks like:
select Id,SystemModStamp,ContentDocument.CreatedDate, ContentDocument.Id,ContentDocument.LastModifiedDate,ContentDocument.SystemModStamp,ContentDocument.LatestPublishedVersion.CreatedDate,ContentDocument.LatestPublishedVersion.Id,ContentDocument.LatestPublishedVersion.LastModifiedDate,ContentDocument.LatestPublishedVersion.SystemModStamp,ContentDocument.LatestPublishedVersion.Title,ContentDocument.LatestPublishedVersion.VersionData from ContentDocumentLink where Id != null and LinkedEntityId in (select id from opportunity) order by Id desc
To save the changes click on the + button than click Apply changes at the bottom and Save and rebuild source or Save:
Leave A Comment