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}"/>
        <force:inputfield value="{!v.bam1.name}"/>

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"){

Apex controller:

public class BamEditController {
    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

  • is N in capital for Name? Lightning is case sensitive. It wants fields names as it is stored in database. {!v.bam1.Name} – Pranay Jaiswal Feb 28 '18 at 12:53
  • yes @PranayJaiswal it is 'N' only, but i tried by updating to capital N, No luck same error popped up again:( – prasad nagamalli Feb 28 '18 at 13:09

Your problem is here, though you'd be forgiven if you don't see it at first:

<aura:attribute name="bam1" 
    default="{'sObjectType': 'TR_Bank_Account_Master__c'}"/>

Lightning is case-sensitive, so you have a case-sensitive problem here; a record's type should be sobjectType, not sObjectType:

<aura:attribute name="bam1" 
    default="{'sobjectType': 'TR_Bank_Account_Master__c'}"/>

Also, as pointed out in the comments:

    <force:inputfield value="{!v.bam1.name}"/>

Would also be an error; you need to observe field capitalization:

    <force:inputfield value="{!v.bam1.Name}"/>

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.