+ Start a Discussion
InboxOInboxO 

Failed to save campingListItem.cmp: Invalid <aura:attribute> type: Camping_Item__c: Source

I get the following error when I try to save the code 
"Failed to save campingListItem.cmp: Invalid <aura:attribute> type: Camping_Item__c: Source"
<aura:component>
    <aura:attribute name="item" type="Camping_Item__c" required="true" />
    
    <p>Name:
        <ui:outputText value="{!v.item.Name}"/>
    </p>
    
    <p>Price:
        <lightning:formattedNumber value="{!v.item.Price__c}" style="currency"/>
    </p>
    
    <p>Quantity:
        <lightning:formattedNumber value="{!v.item.Quantity__c}" style="number"/>
    </p>

        
    <p>
        <lightning:input type="toggle"                            
                         label="Packed?"                           
                         name="Packed"                         
                         checked="{!v.item.Packed__c}" />
     </p> 
    
</aura:component>
Best Answer chosen by InboxO
ravi soniravi soni
hi InboxO,
You cmp is looking good but make sure you have this Camping_Item__c object or check your object name.
don't forget to mark it as best answer.
Thank you
 

All Answers

CharuDuttCharuDutt
Hii inbox
Type Of  Attribute can Of List Text Number or Boolean You Cant Use Custom Field In Attribute Bt you Can Set Attribute Value From Controller Or Helper
 
<!--Basic types-->
    <aura:attribute name="ItemName" type="String" default="Bag"/>
    <aura:attribute name="SerialNumber" type="Long" default="1"/>
    <aura:attribute name="Quantity" type="Integer" default="2"/>
    <aura:attribute name="Price" type="Decimal" default="blue"/>
    <aura:attribute name="PurchaseDate" type="Date" default="2018-11-9"/>
    <aura:attribute name="Dispatched" type="Boolean" default="true"/>
    <aura:attribute name="Color" type="String" default="blue"/>
    
    <!--Collection types-->
    <aura:attribute name="ColorArray" type="String[]" default="['red', 'green', 'blue']"/>
    <aura:attribute name="ColorList" type="List" default="['red', 'green', 'blue']"/>
    <aura:attribute name="ColorMap" type="Map" default="{a: 'red', b: 'green', c: 'blue'}"/>
    <aura:attribute name="ColorSet" type="Set" default="['red', 'green', 'blue','red']"/>
    
    <!--Object types-->
    <aura:attribute name="PersonObject" type="Object" default="{'name': 'John', 'age': '25'}"/>

Please Mark It As Best Answer If It Helps
Thank You!
ravi soniravi soni
hi InboxO,
You cmp is looking good but make sure you have this Camping_Item__c object or check your object name.
don't forget to mark it as best answer.
Thank you
 
This was selected as the best answer
ravi soniravi soni
hi InboxO,
did you apply my solution?
let me know if it help you by marking it as best answer.you best mark give us motivation to helping others.
Thank you