Регистрация  |  Вход

Неожиданные ошибки в неожиданных местах: "Implementation restriction: ContentDocumentLink requires a filter by a single Id..."

вот если сделать так:

Set<id> myIds = new Set<id>();

List<Contact> myContacts = [SELECT id FROM Contact WHERE id IN :myIds];

то ничего страшного не будет, ну пришел в SOQL пустой Сет, да и ладно

а вот если сделать также, но с ContentDocumentLink:

Set<id> myIds = new Set<id>();

for(ContentDocumentLink cdlForEvent: [SELECT ContentDocumentID, LinkedEntity.type, LinkedEntityId 
                                    FROM ContentDocumentLink 
                                    WHERE ContentDocumentID IN: myIds])

то СФ сразу в скандал и слезы:

"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."

причем сообщение в ошибке сильно misleading

в общем это описано здесь:

https://salesforce.stackexchange.com/que ... n-clause

один ответ правильно указывает, что просто нужно чекать не пустой ли Сет
вот если сделать так:

[code]
Set<id> myIds = new Set<id>();

List<Contact> myContacts = [SELECT id FROM Contact WHERE id IN :myIds];
[/code]

то ничего страшного не будет, ну пришел в SOQL пустой Сет, да и ладно

а вот если сделать также, но с ContentDocumentLink:

[code]
Set<id> myIds = new Set<id>();

for(ContentDocumentLink cdlForEvent: [SELECT ContentDocumentID, LinkedEntity.type, LinkedEntityId 
                                    FROM ContentDocumentLink 
                                    WHERE ContentDocumentID IN: myIds])
[/code]

то СФ сразу в скандал и слезы:

[i]"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."[/i]

причем сообщение в ошибке сильно  misleading

в общем это описано здесь:

https://salesforce.stackexchange.com/questions/128255/contentdocumentlink-filter-error-on-contentdocumentid-using-in-clause

один ответ правильно указывает, что просто нужно чекать не пустой ли Сет