function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
tyler_jenningstyler_jennings 

Apex code access inconsistencies in Customer Portal

We have a simple trigger that takes the name of the owning group of a case and assigns that value to a field on the case for easy reporting & view creation. This trigger works fine in tests as well as for regular SFDC users. However, this trigger throws an exception when it is executed during the creation of a case from the customer portal.

The trigger:

Map queues =
new Map([select id, name from Group where type = 'Queue']);

for (Case ca : Trigger.new) {
if(queues.containsKey(ca.ownerId)) {
ca.escalation_group__c = queues.get(ca.ownerId).name;
}
}
}

The Customer Portal Exception:

Apex trigger updateEscalationGroup caused an unexpected exception, contact your administrator: updateEscalationGroup: compiling trigger body caused by: line 3, column 26: sObject type 'Group' is not supported.

From what I've read I thought apex code was not limited by the object access of the executing user. At first glance this does appear to be a permission issue, but I have not been able to find any way to effectively change it.

Thanks,

-Tyler
Ron HessRon Hess
this is an issue known to our development team, is/ will be fixed in next release.  You are correct about the permissions, in this case (portal execution) 'system mode' does not have read perms on the group object.
Shai FisherShai Fisher
I have the same problem, when trying to query Group in a package install handler:
"sObject type 'Group' is not supported."