I am facing below issue in Lightning component.
A Component Error has occured! Error: Unable to find action 'getAccountRecord' on the controller of c:CmpProfileSearch Component: c:CmpProfileSearch . Caused by: Unable to find action 'getAccountRecord' on the controller of c:CmpProfileSearch
Component:
ControllerJs:
({
doInit: function(component, event, helper){
var oppt = component.get("c.getAccountRecord");
}
})
Helper.Js:
({ getAccontRecord : function( component,helper,event ) {
var action = component.get("c.getAccountRecord");
console.debug('valuesssss++'+action);
//Calling Apex class controller 'getAccountRecord' method
action.setParams({accId: component.get("v.accId")});
action.setCallback(this, function(response) {
var state = response.getState(); //Checking response status
var result = JSON.stringify(response.getReturnValue());
Alert(result);
if (component.isValid() && state === "SUCCESS")
component.set("v.accLst", response.getReturnValue()); // Adding values in Aura attribute variable.
});
$A.enqueueAction(action);
}
})
4 respostas
If you notice the name is different in Apex controller:
Client side controller is searching for getAccountRecord method and Apex controller is having method name as getAccontRecord.
Also helper class is having function with same name getAccontRecord. Please make sure to change it to some different name.
Please validate the spelling of Accont it does not have "u" character