Does anyone know how I fix this error in my aura lightning component? My action isn't retrieving the Opportunity records anymore. It was working fine last month, but has stopped working. I am new to coding and any assistance would be great! Thank you

enter image description here


   public with sharing class UpdateExistingPaxController {

public static List <Opportunity> fetchOpportunity(String oppRecordId) {

    return [SELECT Id, Name, Trip_File_LEAD__c
            FROM Opportunity
            WHERE Lead_PAX__c = :oppRecordId];  


   <aura:component controller="UpdateExistingPaxController"
            implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >

<aura:attribute name="OpportunityList" type="List" access="global" />
<!-- <aura:attribute name="SyncedQuoteId" type="Id" /> -->
<aura:handler name="init" value="{!this}" action="{!c.loadOpportunities}"/>
<aura:handler event="force:refreshView" action="{!c.loadOpportunities}" />

<div class="slds-grid slds-grid--align-end"> 
    <button class="slds-button slds-button--brand" onclick="{!c.updateFields}">Update</button>



loadOpportunities: function(component, event, helper) {
    var recordId = component.get('v.recordId')

    var action = component.get('c.fetchOpportunity');
          action.setCallback(this, function(response) {
        var state = response.getState();
        if (state === "SUCCESS") {

            component.set('v.OpportunityList', response.getReturnValue());
            component.find("box3").set("v.value", false);


enter image description here

enter image description here


1 Answer 1


It's probably caused by this update - https://admin.salesforce.com/blog/2020/critical-update-ensure-users-have-access-to-auraenabled-methods

which removed automatic access to @AuraEnabled methods for signed in users.

In order to give a user access to @AuraEnabled method, go to the profile, click 'enabled apex class access' and then add the class in question to the 'enabled' list. Alternatively, create a permission set to do the same.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.