afawcett / apex-sobjectdataloader

A generic native SObject data loader implementation using Apex JSON support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tests fail with System.QueryException: Implementation restriction

rsoesemann opened this issue · comments

I have the latest version of both classes and when I run the test I get 6 fails with

System.QueryException: Implementation restriction: CollaborationGroupRecord requires a filter by a single Id, CollaborationGroupId or RecordId using the equals operator

This seems to be a Spring'15 change, looks like one thats leaked through despite the platform API not having been changed.... 👎 I think the fix will be to upgrade classes API version and add this object/relationship to the exclusion list.

I added CollaborationGroupRecord and CollaborationGroupId to the according whitelist (shouldn't they be called blacklists?!) and set class and test to version 32, but nothing changed :-(

// Standard fields that are not included when using the auto config
        private Set<String> relationshipWhitelist = 
            new Set<String>
                { 'OwnerId',
                  'CreatedById',
                  'LastModifiedById',
                  'RecordTypeId',
                  'ProfileId',
                  'CollaborationGroupId'
                };

        // Standard child relationships that are not included when using the auto config
        private Set<String> childRelationshipWhitelist = 
            new Set<String> 
                { 'Shares', 
                  'ProcessInstances', 
                  'ProcessSteps', 
                  'Tasks', 
                  'ActivityHistories', 
                  'Attachments', 
                  'FeedSubscriptionsForEntity', 
                  'Events', 
                  'Notes', 
                  'NotesAndAttachments', 
                  'OpenActivities', 
                  'Histories', 
                  'Feeds',
                  'CollaborationGroupRecord'};      

Hmmmm yeah should be called blacklists actually good point! And yeah that should have worked....

I think the child Relationship name that needs to be white/black listed is RecordAssociatedGroups.

    // Standard child relationships that are not included when using the auto config
    private Set<String> childRelationshipWhitelist = 
        new Set<String> 
            { 'Shares', 
              'ProcessInstances', 
              'ProcessSteps', 
              'Tasks', 
              'ActivityHistories', 
              'Attachments', 
              'FeedSubscriptionsForEntity', 
              'Events', 
              'Notes', 
              'NotesAndAttachments', 
              'OpenActivities', 
              'Histories', 
              'Feeds',
              'RecordAssociatedGroups'
            };

mginou: That indeed helped! Thanks a lot.

Maybe afawcett can merge this into the code or you can provide this a a pull request ;-)

@mginou @up2go-rsoesemann nice work, yes, i'm a little busy at the mo, but not enough to click the merge button a PR for sure! Thanks again! 👍