+ Start a Discussion
Jennifer W. LeeJennifer W. Lee 

Trailhead: Apex components

I am having issues saving the following Lightning component as part of the Using Apex in Components:

-Given an existing Apex class that can be found here, create a component that displays the case's subject, description and status.The component must be named 'DisplayCase'.
-The component must refer to the 'DisplayCaseController' Apex class. Copy and paste that class into your Developer Edition using the Developer Console.
-The component must have an attribute named 'record' to hold the Case record.
-The component must display the Subject, Description, and Status values of the 'record' attribute.
-The client-side controller for the component must bind to the 'getCaseFromId' method of the Apex controller to fetch the value of a Case record.
-Note that while the Apex class accepts a null and returns a default case, there are various ways to hand the ID to the controller.



FIELD_INTEGRITY_EXCEPTION
Failed to save undefined: No ATTRIBUTE named label found: Source

Component:
<aura:component Controller="DisplayCaseController">
    <aura:attribute name="record" type="Case[]"/>
    <ui:button label="Get Cases" press="{!c.getCaseFromId}"/>
    <ui:outputText Label="Case Subject:" value="{!case.Subject}"/><br/>
    <ui:outputText Label="Case Description:" value="{!case.Description}"/><br/>
    <ui:outputText Label="Case Status:" value="{!case.Status}"/><br/>
</aura:component>

I'm not sure what the issue is. Help...

Controller:
({
    getCaseFromId: function(component){
        var action = component.get("c.getCases");
        action.setCallback(this, function(a){
        	component.set("v.record", a.getReturnValue());
        });
	 $A.enqueueAction(action);
    }
})

 
Sandeep BhanotSandeep Bhanot
Sometimes the Developer Console gets into a weird state and you start seeing those type of error messages on save. I would recommend opening a new incognoto browser window, logging in again and trying to save the component again in the Dev. Console. Hope this helps!
Sandeep Bhanot
Salesforce.com
Jennifer W. LeeJennifer W. Lee
@sandeepBhanot I tried what you suggested and it didn't resolve the issue. I even logged into a fairly clean org (only has the javascript component challenge) and I got the same issue there too
Thierry JORANDThierry JORAND
@Jennifer Lee
Try  <ui:outputText  value="{!case.Subject}"/><br/>
As  I experienced label is recognised in inputText but not in outputText.
Furthermore the Apex Controller is getCaseFromId and not getCase and it returns a case and not a list of cases so you would had better results with :
   <aura:attribute name="record" type="Case"/>
and with :        var action = component.get("c.getCaseFromId");
You need also an another attribute to pass an Id as a  parameter which is expected by the apex server side controller.

If this answers your question, please be sure to mark this as the correct answer. Thank you.
 
Nicholas SantosoNicholas Santoso
Also, one other thing you would need to do is add a 'v' before 'case' since this refers to the component’s attribute set.
Ashish_Sharma_DEVSFDCAshish_Sharma_DEVSFDC
Hi ,

I am also facing same issue .Is there any solution for this.
 
Mahesh AdiMahesh Adi
I have the same problem is there any solution?
Seokjoo KimSeokjoo Kim
It worked and the component is saved with the DisplayCaseContoller following steps:
 - Associate the component to some othere APEX controller that had been used for other component
   ex) controller="AccountHandler"
 - Then re-associate the component to DisplayCaseController
   ex) controller="NS.DisplayCaseController"


 
Kumari PurnimaKumari Purnima
Try this code, This is working absolutely fine.

DisplayCase.cmp
<aura:component controller="DisplayCaseController">
    <aura:attribute name="record" type="Case[]"/>

    <aura:iteration items="{!v.record.Subject}" var="c">
        {!c.Subject}, {!c.Description}, {!c.Subject}, {!c.Status }
    </aura:iteration>
    
    <aura:iteration items="{!v.record.Description}" var="c">
        {!c.Subject}, {!c.Description}, {!c.Subject}, {!c.Status }
    </aura:iteration>
     <aura:iteration items="{!v.record.Status}" var="c">
        {!c.Subject}, {!c.Description}, {!c.Subject}, {!c.Status }
    </aura:iteration>
</aura:component>

DisplayCaseController.js
({
    getRecord: function(cmp){
        var action = cmp.get("c.getCaseFromId");
        action.setCallback(this, function(response){
            var state = response.getState();
            console.log(state);
            if (state === "SUCCESS") {
                cmp.set("v.record.Subject", response.getReturnValue());
            }
        });
     $A.enqueueAction(action);
    }
})

Hope it will help you.