+ Start a Discussion

help to find mistake

I need display data as a list receiving via class FindDuplicateCase to aura component. But I have empty page, although the class returns values when debugging 
Class Apex
public class FindDuplicateCase {
    public static List<Case> getCaseListDuplicate(){
        List<Case> caseFields =[SELECT Id,CaseNumber,Origin,Subject,SuppliedEmail,Status,Reason,OwnerId FROM Case WHERE Status!='Closed'];
        List<Case> duplicateCaseList = new List<Case>();
        for(Case case1:caseFields){
           for(Case case2:caseFields){
               if(case1.Subject==case2.Subject && case1.SuppliedEmail==case2.SuppliedEmail && case1.Reason==case2.Reason){
        return duplicateCaseList; 
Aura component 
<aura:component implements="force:lightningQuickAction" controller="FindDuplicateCase" access="global">
    <aura:handler name="init" action="{!c.doInit}" value="{!this}" />
    <aura:attribute name="duplicateCaseList" type="List" />
        <aura:iteration items="{!v.duplicateCaseList}" var="item">
                <li>Case Number{!item.CaseNumber}</li>
    doInit: function(component, event, helper) {
        const list = component.get('c.getCaseListDuplicate');
Best Answer chosen by AntonPavlov
Sachin HoodaSachin Hooda
You're missing out some pieces of the code. To make a server call & store the response. You need to set a callback. So whenever the server replies to your request, the code in the callback would be executed, the returned response in your case. To add a callback to the server-side call you need to change your like, 
const list = component.get('c.getCaseListDuplicate');
 action.setCallback(this, function(response){
           if(response.getState() === 'SUCCESS'){
             } else {
                 console.log('::Some error occurred::');

Since server response isn't instant. This way whenever the server responds to your request. the code within action.setCallback(this, function(response){ .....}); will be executed.