1

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);
    }
    }
})
2
  • Instead of <aura:attribute name="newAccount" type="Account" />, use this line - <aura:attribute name="newAccount" type="Account" default="{'sobject' : 'Account', 'phone' : '', 'website':''}"/> Oct 20, 2016 at 12:09
  • You've also got an extra closing } in your controller. Is that a copy/paste typo? Oct 20, 2016 at 12:10

1 Answer 1

0

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);

To

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

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

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .