• Rudolf Habenbacher
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hello all,

I'm stuck with the Lightning challenge "Using Apex in Components" :

here is the component :
<aura:component controller="DisplayCaseController">
	<aura:attribute name="record" type="Case[]"/>

    <aura:iteration items="{!v.record}" var="c">
	    {!c.Subject}, {!c.Description}, {!c.Subject}, {!c.Status }
	</aura:iteration>
</aura:component>
the component controller :
({
    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", response.getReturnValue());
            }
        });
	 $A.enqueueAction(action);
    }
})
and the apex controller (provided for the challenge)
public class DisplayCaseController {
 
    @AuraEnabled
    public static Case getCaseFromId(Id caseID) {
        if(caseID == null) {
            return [SELECT ID, Subject, Description, STATUS from Case LIMIT 1];
        }
            List<Case> cases = [ SELECT Id, Subject, Description, Status from CASE where ID = :caseID ];
            if(cases.size() == 0) {
                return [SELECT ID, Subject, Description, STATUS from Case LIMIT 1];
            } else {
                return cases[0];
        }
    }
}
and still when hitting the Check challenge button, the following error is displayed :
"Challenge not yet complete... here's what's wrong:
The component is not binding to the Case Subject value "

Could you please advise ?
Thanks a lot!