When executing this query I'd expect this query to throw an exception, since the object does not have record types. but it doesn't. Why doesn't it throw an exception

      (SELECT Id, ContentDocumentId, LinkedEntityId 
      FROM ContentDocumentLinks 
        LinkedEntity.Type = 'CustomObjNameWithoutRecordTypes' AND 
        LinkedEntity.RecordType.DeveloperName IN ('Hello', 'Goodbye'))
      FROM ContentDocument 

1 Answer 1


For polymorphic relationships of this nature, it doesn't matter if the filtered object doesn't have record types. As long as it is possible that record types could exist in the org, then filters of this nature will never fail. However, note that sometimes this can also lead to bugs, so always test the query to see if it will be a problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .