I'm trying to dynamically create a custom component and insert it into the body of another one. That component (CaseComponent) has a Case attribute. The trouble is that the Case attribute is never filled, and I get an error when I try to reference the Case's fields, such as the CaseNumber.

Here is the Case Component:

<aura:attribute type="Case" name="case"/>
<div class="case">
    <p class="textCenter caseNumber">{!case.CaseNumber}</p>
    <p>Status: {!case.Status}</p>
    <p>Subject: {!case.Subject}</p>

Here is the javascript controller that tries to make this component dynamically.

    "case": testCase,
    if (component.isValid()) {
        var body = component.get("v.body");
        component.set("v.body", body);

I'm getting the following error message

"Assertion Failed!: Unable to get value for key 'case.CaseNumber'. No value provider was found for 'case'. : false. Please try again."

If anyone has any idea as to what I could be doing wrong for this not to work, it would be much appreciated.

1 Answer 1


Your logic is right, but your syntax is incorrect. Try changing {!case.CaseNumber} to {!v.case.CaseNumber} and do the same for the others.

You must log in to answer this question.

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