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
APEX:
public with sharing class UpdateExistingPaxController {
@AuraEnabled
public static List <Opportunity> fetchOpportunity(String oppRecordId) {
return [SELECT Id, Name, Trip_File_LEAD__c
FROM Opportunity
WHERE Lead_PAX__c = :oppRecordId];
}
COMPONENT:
<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>
</div>
CONTROLLER:
({
loadOpportunities: function(component, event, helper) {
var recordId = component.get('v.recordId')
var action = component.get('c.fetchOpportunity');
action.setParams({oppRecordId:recordId});
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);
}
});
$A.enqueueAction(action);
},
response.getError()