You need to sign in to do that
Don't have an account?
sakthidharan Ambayiram
getting the below error for the component when i try fetch the filter accounts
Hi all,
Error: This page has an error. You might just need to refresh it.
Error in $A.getCallback() [response.getReturnValue is not a function]
Callback failed: apex://getAccountList/ACTION$getFilterAccounts
Failing descriptor: {c:AccList}
**************component
<aura:component controller="getAccountList">
<aura:attribute name="AccList" type="List" />
<lightning:button label="Get All Filter Accounts" onclick="{! c.getFilterAccountss}" />
<aura:iteration items="{! v.AccList}" var="Acc" >
<tr>
<td>{! Acc.Id}</td>
<td>{! Acc.Name}</td>
<td>{! Acc.Phone}</td>
<td>{! Acc.Type}</td>
</tr>
</aura:iteration>
</aura:component>
********************apex class
public class getAccountList {
@AuraEnabled
public static List<Account> getFilterAccounts(){
return[select Id,Name,Type,Phone from Account where Type='Prospect'];
}
}
************************controller
({
getFilterAccountss : function(component, event, helper) {
var accRef = component.get("c.getFilterAccounts");
accRef.setCallback(this,function (response){
var response = response.getState();
if(response=="SUCCESS"){
//alert("Success");
component.set("v.AccList",response.getReturnValue());
}else{alert("No Response")}
});
$A.enqueueAction(accRef);
}
})
please help me to resolve this issue
Error: This page has an error. You might just need to refresh it.
Error in $A.getCallback() [response.getReturnValue is not a function]
Callback failed: apex://getAccountList/ACTION$getFilterAccounts
Failing descriptor: {c:AccList}
**************component
<aura:component controller="getAccountList">
<aura:attribute name="AccList" type="List" />
<lightning:button label="Get All Filter Accounts" onclick="{! c.getFilterAccountss}" />
<aura:iteration items="{! v.AccList}" var="Acc" >
<tr>
<td>{! Acc.Id}</td>
<td>{! Acc.Name}</td>
<td>{! Acc.Phone}</td>
<td>{! Acc.Type}</td>
</tr>
</aura:iteration>
</aura:component>
********************apex class
public class getAccountList {
@AuraEnabled
public static List<Account> getFilterAccounts(){
return[select Id,Name,Type,Phone from Account where Type='Prospect'];
}
}
************************controller
({
getFilterAccountss : function(component, event, helper) {
var accRef = component.get("c.getFilterAccounts");
accRef.setCallback(this,function (response){
var response = response.getState();
if(response=="SUCCESS"){
//alert("Success");
component.set("v.AccList",response.getReturnValue());
}else{alert("No Response")}
});
$A.enqueueAction(accRef);
}
})
please help me to resolve this issue
All Answers