I am having an issue returning the attachment details related to my caseId. Everything I have done should work but it isn't, I have managed to return the names ect within my dev console using the SOQL. The issue is it will not return to my component when the component is loaded on screen.
ApexController
@AuraEnabled
public static Attachment getAtt(Id caseId){
return ([Select id, ParentId, Name
From Attachment Where ParentId=:caseId]);
}
Lightning Controller
doInit : function(component, event, helper) {
component.set("v.isError", false)
component.set("v.showEditView", false);
component.set("v.errorMsg", "");
//helper.getPicklistValue(component);
var action = component.get("c.getAtt");
action.setParams({
caseId : component.get("v.caseId")
});
action.setCallback(this, function(a) {
if (a.getState() === "SUCCESS") {
component.set("v.Attachment", a.getReturnValue());
}
});
$A.enqueueAction(action);
},
LightningComponent
<aura:component controller="AmexComm_SecureMsgController" implements="forceCommunity:availableForAllPageTypes,force:hasRecordId" access="global">
<aura:attribute name="Attachment" type="Attachment"/>
<aura:attribute name="showListView" type="Boolean"/>
<aura:attribute name="showCreateNew" type="Boolean"/>
<aura:attribute name="showAttachment" type="Boolean"/>
<aura:attribute name="lstSubs" type="Object[]"/>
<aura:attribute name="isError" type="Boolean"/>
<aura:attribute name="errorMsg" type="String"/>
<aura:attribute name="caseId" type="String" default="{!v.recordId}"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<h3 class="slds-section-title--divider" style="margin-left: 1.5rem; max-width: 657px;">Exisiting Attachments</h3>
<h3 class="slds-section-title--divider" style="margin-left: 1.5rem; max-width: 657px;">
<span class="text-blue"> {!v.Attachment.name}</span></h3> <!-- pull attachments associated to case -->
<h3 class="slds-section-title--divider" style="margin-left: 1.5rem; max-width: 657px;">
<span class="text-blue"> {!v.Attachment.name}</span></h3>
</aura:component>