I have a custom aura component was built to have a custom lookup field in it. The custom aura lookup field takes a search query and replicates standard lookup fields dynamic dropdown. The component works in our PartialBox
and does not work in our Fullbox
:
Summary of Environment Settings
- Environments' are both on preview of
Summer 22'
- Environments' (Partial vs Fullbox)
Profile
MetaData is identical. - Environments'
PermissionSet
MetaData is identical. - Environments' Profiles do have access to the
Apex Class
that is running the query(see below). - Environments' Profiles/Permission sets have
modify all
on the custom object and its lookup object. - Environments'
Aura Components
are identical . - Environments'
Apex Class
andAuraMethods
are identical
I'm confident there has to be another way to grant access to apex class that is missing. But even running it as a System Admin is displaying the errors in the screen shot.
Helper.JS
getSchools: function (component, event) {
var action = component.get("c.getAllRecords"),
searchText = event.getSource().get('v.value'),
searchTextLength = searchText.length,
className = event.getSource().get('v.class');
action.setParams({
searchKeyWord: searchText,
objectApiName: 'Custom_SalesforceObj__c',
colums: 'Id, Name '
});
action.setStorable();
action.setCallback(this, function (response) {
$A.util.removeClass(component.find("mySpinner"), "slds-show");
var state = response.getState();
if (state === 'SUCCESS') {
var data = response.getReturnValue();
if (data.length == 0) {
component.set('v.isMessage', false);
component.set("v.schoolList", []);
component.set('v.editSchoolList', []);
component.set("v.Message", 'No Result Found...');
} else if (data.length > 0) {
var forOpen;
if (className.indexOf('editLookup') > -1) {
forOpen = component.find("editSearchRes");
component.set('v.editSchoolList', data);
} else {
component.set('v.isMessage', false);
forOpen = component.find("searchRes");
component.set('v.schoolList', data);
}
component.set("v.Message", '');
component.set('v.hideResultClassName', 'slds-show');
} else {
component.set('v.editSchoolList', []);
component.set("v.schoolList", []);
var forclose = component.find("searchRes");
$A.util.addClass(forclose, 'slds-is-close');
$A.util.removeClass(forclose, 'slds-is-open');
component.set('v.hideResultClassName', 'slds-hide');
}
}
});
$A.enqueueAction(action);
ApexClass.getAllRecords() (called From JS)
@AuraEnabled
public static List < sObject > getAllRecords(String searchKeyWord, String objectApiName, String colums) {
List < sObject > recordList = new List < sObject > ();
String searchKey = '%' + searchKeyWord + '%';
if (searchKeyWord != null && searchKeyWord.length() >= 1 ) {
try {
recordList = Database.query('SELECT ' + colums + ' FROM ' + objectApiName + ' WHERE Name LIKE: searchKey LIMIT 25');
if(Test.isRunningTest()){
throw new DMLException('Records not found');
}
} catch (DMLException ex) {
AuraHandledException e = new AuraHandledException('There is a problem in to get details for current user. ' + ex.getMessage());
e.setMessage('There is a problem in to get details for current user.' + ex.getMessage());
throw e;
}
if (recordList.size() > 0) {
return recordList;
}
}
return recordList;
}