1

I have a component that will live on a case page where I want to show case comments and make an easy way for them to toggle them between public and private in lightning. However it retrieves the info but will not render any information on the page except for the case comment id. I know it's retrieving the records because it shows a line with id for every comment but will not render the commentbody or any other field from the object What am I doing wrong

.cmp

<aura:component controller="mevLCaseComment" implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
    <aura:attribute name="commentList" type="casecomment[]" />
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />   
    <aura:iteration items="{!v.commentList}" var="cc" >
        {!cc.Id} - {!cc.commentbody} <br/>
    </aura:iteration>
</aura:component>

.js

({
   doInit : function(component, event, helper) {
     var action = component.get("c.getCaseComments");
     var rcid = component.get("v.recordId");
     action.setParams({ "ccid" : rcid });       
     action.setCallback(this, function(data){
       component.set("v.commentList",data.getReturnValue());
     });       
     $A.enqueueAction(action);
   }
})

apex class

public class mevLCaseComment {
    @AuraEnabled
    public static list<casecomment> getCaseComments(id ccid) {
        system.debug(logginglevel.info, 'MEVION DEBUG: case id ' + ccid);
        return [Select Id, commentbody From casecomment Where parentid = :ccid]; 
    }
}
2

Lightning is case sensitive.

{!cc.Id} - {!cc.commentbody}

Here, API name of commentbody is CommentBody

{!cc.Id} - {!cc.CommentBody}

This should work

2
  • Ah so even though my query is all lower case in the apex method on the lightning component page I must reference the way it's spelled in the API model. Thanks @salesforcesas – Ohmicron Jul 23 '19 at 17:01
  • Yes! you are right. Pls mark answer accepted if it solved. – salesforce-sas Jul 23 '19 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.