i am trying to show a object field in edit mode in lightning component. for that i have written a lightning component and invoking this from a quick action but i am getting the run time exception as org.auraframework.throwable.AuraRuntimeException: Error Retrieving Field for: v.bam1.name my code is as below.. Lightning component:
<aura:component implements="force:lightningQuickAction,force:hasRecordId" controller="BamEditController">
<aura:attribute name="bam1" type="TR_Bank_Account_Master__c" default="{'sObjectType': 'TR_Bank_Account_Master__c'}"/>
<aura:handler name="init" value="{!this}" action="{!c.doInIt}"/>
<apex:form>
<force:inputfield value="{!v.bam1.name}"/>
</apex:form>
</aura:component>
JS Controller:
({
doInit : function(component, event, helper) {
var action =component.get("c.getBanks");
action.setParams({"bamId": component.get("v.recordId")});
action.setCallBack(this, function(response){
var state = response.getState();
if(state=== "SUCCESS"){
component.set("v.bamId",response.getReturnValue());
console.log(response.getReturnValue());
}
}
);
$A.enqueueAction(action);
}
})
Apex controller:
public class BamEditController {
@auraEnabled
public static TR_Bank_Account_Master__c getBanks( ID bamId){
system.debug('prasad id:'+bamId);
TR_Bank_Account_Master__c bams;
if(bamId !=null){
// id bamID= ApexPages.currentPage().getParameters().get('id');
bams = [select id, name,A_C_Status__c,A_C_Number__c,Bank_Name_Familly__c,Bank_Name_Local__c from TR_Bank_Account_Master__c where id =: bamId LIMIT 1];
}
return bams;
}
}
Please correct me where i am wrong..., Thanks