I am making a Lightning component and am getting the following error:

Access Check Failed! AttributeSet.get(): attribute 'newaccount' of component 'markup://c:FirstComponent {6:2223;a}' is not visible to 'markup://c:FirstComponent {6:2223;a}'.

Here's my Component markup:

<aura:component controller="NewAccount" implements="flexipage:availableForAllPageTypes">
    <aura:handler name="init" action="{!c.CreateAccount}" value="{!this}"/>

    <aura:attribute name="newAccount" type="Account" />
    <p class="slds-text-heading--label">Accounts</p>

    <div class="slds-col slds-col--padded slds-p-top--large">

    <ui:inputtext aura:id="name" label="name" value="{!v.newaccount.name}" required="true"/>

    <ui:inputText aura:id="website" label="website" value="{!v.newaccount.website}" />

    <ui:inputtext aura:id="phone" label="phone" value="{!v.newaccount.phone}" />

Here's the client-side controller:

    CreateAccount : function(component, event, helper) {
        var ph = component.find("phone");
        var pc = ph.get("v.value");
        var action = component.get("c.newAccount");
        component.set("v.newaccount", action);
  • Instead of <aura:attribute name="newAccount" type="Account" />, use this line - <aura:attribute name="newAccount" type="Account" default="{'sobject' : 'Account', 'phone' : '', 'website':''}"/> – Santanu Halder Oct 20 '16 at 12:09
  • You've also got an extra closing } in your controller. Is that a copy/paste typo? – André Dion Oct 20 '16 at 12:10

First of all in LC, everything is case-sensitive.As the error points out there's attribute named newaccount is not visible means, there's no aura:attribute with named newaccount is present.

Looking at your component markup, there's an aura:attribute named newAccuont

So all you need to do is change this line:



component.set("v.newAccount", action);

Also set the default for the above attribute as @SantanuHalder suggested.

| improve this answer | |

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.