function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
VenkateshVenkatesh 

Assertion Failed!: Unable to get value for key.

Hi 

I am new to lightning, I am trying to create a lightning app which have to do action(replaceing URL hacking).
when i am trying to execute the application it showing an error as shown below.

"This page has an error. You might just need to refresh it. Assertion Failed!: Unable to get value for key 'AIO.doInit'. No value provider was found for 'AIO'. : false Failing descriptor: {AIO:myFirstURLHACKApp}"

Here AIO is my name space.
VenkateshVenkatesh
component :
<aura:component controller="AIO.AccountFormByIDController"  >
    <aura:attribute name="accGetID" type="String"/> 
    <aura:attribute name="ac" type="Account"/>   
    <aura:handler name="init" value="{!this}" action="{!AIO.doInit}" />
    <ui:inputText label="Account Name" value="{!v.ac.Name}"/>
    <ui:inputText label="Type" value="{!v.ac.Type}"/> 
    <ui:inputText label="Industry" value="{!v.ac.Industry}"/>  
</aura:component>

controller:
({
    doInit : function(component, event) {
             alert('Test');
              var action = component.get("AIO.find_AccById");
              action.setParams({ "get_accountid": component.get("v.accGetID") });
               action.setCallback( this, function(response) {
              var state = response.getState();
                  if (state === "SUCCESS") {
                       component.set("v.ac", response.getReturnValue());
                       console.log(response.getReturnValue());
                  }
              });
        $A.enqueueAction(action);
    },
})
VenkateshVenkatesh
Thanx piyush ,
But this time it showing different error as,

This page has an error. You might just need to refresh it. Assertion Failed!: no client action by name {!doInit} : false Failing descriptor: {AIO:myFirstURLHACKApp}.

This is my apex controller.

public with sharing class AccountFormByIDController {
    @AuraEnabled
    public static Account find_AccById(Id get_accountid) {
        system.debug('entered into apex');
        if(get_accountid != null ) {
            system.debug('entered into if in apex');
            return [SELECT Id, Name, Type, Industry from Account where ID = :get_accountid];
        }
        else{
            system.debug('entered into else in apex');
            return [SELECT ID,  Name, Type, Industry from Account LIMIT 1];
        }     
    }
}
sfdcMonkey.comsfdcMonkey.com
use c. before javaScript doInit function, use below code :
<aura:component controller="AIO.AccountFormByIDController"  >
    <aura:attribute name="accGetID" type="String"/> 
    <aura:attribute name="ac" type="Account"/>   
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <ui:inputText label="Account Name" value="{!v.ac.Name}"/>
    <ui:inputText label="Type" value="{!v.ac.Type}"/> 
    <ui:inputText label="Industry" value="{!v.ac.Industry}"/>  
</aura:component>
i hope it helps you.
      Let me inform if it helps you and kindly mark it best answer if it helps you so it make proper solution for others
    thanks 
    http://sfdcmonkey.com  (http://sfdcmonkey.com )
 
VenkateshVenkatesh
Thank you for your effort.It showing the error as,

Unable to find 'doInit' on 'compound://AIO.AccountFormByID'. Failing descriptor: {markup://AIO:AccountFormByID}
 
sfdcMonkey.comsfdcMonkey.com
Try this one :

Lightning Component
<aura:component controller="AIO.AccountFormByIDController"  >
    <aura:attribute name="accGetID" type="String"/> 
    <aura:attribute name="ac" type="Account"/>   
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
      <ui:inputText label="Account Name" value="{!v.ac.Name}"/>
      <ui:inputText label="Type" value="{!v.ac.Type}"/> 
      <ui:inputText label="Industry" value="{!v.ac.Industry}"/>  
</aura:component>
Controller
({
    doInit : function(component, event) {
             alert('Test');
              var action = component.get("AIO.find_AccById");
              action.setParams({ 
                   "get_accountid": component.get("v.accGetID")
               });
               action.setCallback( this, function(response) {
              var state = response.getState();
                  if (state === "SUCCESS") {
                       component.set("v.ac", response.getReturnValue());
                       console.log(response.getReturnValue());
                  }
              });
        $A.enqueueAction(action);
    },
})
Thanks


 
VenkateshVenkatesh
Is there any wrong in my application code.
 
<aura:application >
    <aura:attribute name="AccountId" type="String"/>
      Value in AccountId Attribute: {!v.AccountId}
    <AIO:AccountFormByID accGetID="{!v.AccountId}"/>
</aura:application>