2

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 and AuraMethods 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.

No Profiling Information

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;
    }
6
  • 1
    You'll need to check your TraceFlag and DebugLevel settings. If you don't ask for profiling, you don't get any profiling.
    – sfdcfox
    Commented May 19, 2022 at 19:05
  • I have profiling set to finest when I got these logs.
    – thinker
    Commented May 19, 2022 at 19:18
  • 1
    Not sure what to say, then. Nothing seems amiss here. Maybe you're looking at the wrong log? I know I do that all the time.
    – sfdcfox
    Commented May 19, 2022 at 19:23
  • Is it possible that it's failing because the method is being called on keyup? Meaning too many call outs to server?
    – thinker
    Commented May 19, 2022 at 19:31
  • 1
    Actually, that makes sense. It was deprecated in v53.0 or so. Use cacheable=true instead if you want to cache the results.
    – sfdcfox
    Commented May 19, 2022 at 19:48

1 Answer 1

2

Here is the issue. Per @sfdcfox.

We had action.setSTorable() as part of the call out to the apex method. It's unclear to me the mechanism that was causing this to fail, but the primary reason is that it was deprecated.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .