SOQL does not work in System Mode of the Tasks in Community
Last updated 2017-05-09 ·Reference W-2767845 ·Reported By 6 users
Summary
SOQL executed inside a without sharing Apex class which is executed by a community user is not running in system context
Repro
1. Create the below Apex class
2. Create the below Visualforce page
3. Create a Visualforce Tab using the below created Visualforce page
4. Add tab to community
5. Add Apex class and Visualforce page to community users profile
6. Log into community as community user and hit the get task count button on Visualforce Tab page. Count will be 0.
public class AccountTasks {
public Integer task { get; set; }
public void getTaskCount(){
task = [SELECT count() FROM Task];
}
}
<apex:page controller="AccountTasks">
<apex:form >
<apex:pageBlock >
<apex:commandButton action="{!getTaskCount}" value="Get Task Count" reRender="block"/>
</apex:pageBlock>
<apex:pageBlock id="block" >
<apex:pageBlockSection id="blockSection" columns="1">
Task Count: {!task}
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Workaround
None
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.