function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Danryl Carpio 8Danryl Carpio 8 

Another Approach for Getting the Apex(Server side Controller) returned value in Lightning

Can you tell me what are the other approaches for getting the Apex(Server Side Controller) in Lightning. The Only one i know is the data.getReturnedValue(). What i want is to avoid Merging the duplicate records. For Example the apex returned a list with the same element value {marvin,marvin}. The data.getReturnedValue() will return only 1 marvin. and What i want is to return all the element value eventhough there are duplicate records.

JS CLIENT SIDE CONTROLLER

({ 
    doInit : function(component, event, helper) 
    { var action = component.get("c.GetallContacts"); 
     action.setCallback(this, function(data){
         component.set("v.events", data.getReturnValue()); ////<------------This Line I only know to retrieve the apex serverside controller returned value
     }); 
     $A.enqueueAction(action);
    }, 
})

SERVER SIDE CONTROLLER

    Public Static List<Contact> GetallContacts(){
        List<Ticket__c> ids = TicketIDget();
        Set<String> newids = new Set<String>();
        for(integer i=0; i<ids.size(); i++)
        {
            newids.add(ids[i].Booker__c);
        }
        return [SELECT Name FROM Contact WHERE Id IN:newids];
    }