ISE when deploying SOQL querying using ObjectPermissions
Apex , Packaging , Eclipse IDE
Last updated 2022-02-10 ·Reference W-3754785 ·Reported By 1 users
Summary
SOQL query executed as part of an APEX test in a Metadata Deploy against ObjectPermissions uses a Lookup Relationship then ISE is hit.
Repro
Create test class:
public static void doOffendingQuery(String sObjectName) {
System.debug('***** SFDC sObjectName: ' + sObjectName);
List<ObjectPermissions> perms = [SELECT Parent.ProfileId FROM ObjectPermissions WHERE SObjectType = :sObjectName AND PermissionsModifyAllRecords = TRUE];
}
>> Package to deploy
Deploy-
Using WorkBench:
1) login as user with workbench (workBenchDeploy.zip)
2) Use workbench to deploy (select single package) attached package
3) view error
ANT:
1) add username/password to build.properties file
2) deploy
3) view error
Workaround
Instead of using a Lookup Relationship, the customer can use a join like this:
SELECT ProfileId FROM PermissionSet WHERE Id IN (SELECT ParentId FROM ObjectPermissions WHERE SObjectType = :sObjectName AND PermissionsModifyAllRecords = TRUE)
Reported By (1)
Is it Fixed?
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.