The Following Component is used in the Community and used through Partner Portal profile.
Lightning Component
<lightning:recordEditForm recordTypeId="xxxxxxxxx" objectApiName="Case" onsuccess="{!c.handleSuccess}">
<lightning:messages></lightning:messages>
<lightning:inputField fieldName="CaseDescription__c" />
<lightning:inputField fieldName="Subject" />
<lightning:inputField fieldName="Severity__c" />
<lightning:button class="slds-m-top_small"
type="submit"
label="New Case">
</lightning:button>
</lightning:recordEditForm>
Javascript Controller
({
handleSuccess : function(component, event, helper) {
var payload = event.getParams().response;
console.log('Record id : '+payload.id);
}
})
There is a trigger on the Case object which runs on creation of a Case record.
trigger CaseTriggerHandler on Case (after insert,after update) {
List<User> usrList = [SELECT Name,TimeZoneSidKey FROM User];
System.debug('usrList '+usrList);
System.debug('usrListSize '+usrList.size());
}
[SELECT Name,TimeZoneSidKey FROM User];
The above query is returning only Users of Portal Users profile but not others. Since Trigger runs in system mode why is it not fethcing all the Users that exists in the System ? If i put a WHERE Condition to the query with some other profile id, the query returns NULL.
Note : If use Apex Controller instead of standard submit of lightning record edit and create a record, SOQL DOES return all the Users data correctly. It is NOT returning only when used stanadard submit of lightning record edit form. Since the query is placed in the Trigger why there should be any access issue since it runs in System Mode.
Why the Standard Submit is giving this problem ?