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
Leticia Monteiro Freitas 4Leticia Monteiro Freitas 4 

Error in display Lightning Component Data

Leticia Monteiro Freitas 4Leticia Monteiro Freitas 4
I'm get error in display my data in lightning component. Can anyone help me?

CMP
<aura:component controller ="CEC_360_Gadget_Controller" implements="flexipage:availableForRecordHome,force:hasRecordId"  >
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:attribute name="deviceList" type="CEC_RestObjects.Device"/>
    <aura:attribute name="showSpinner" type="Boolean" default="true"/>
    
    <div class="slds-page-header slds-page-header_record-home">
        <div class="slds-page-header__name">
            <div class="slds-page-header__name-title">
                <h1>
                    <span class="slds-page-header__title"  style="color:#009ed3;" >Aparelho2aaa</span>
                </h1>
                
            </div>
            <div class="slds-m-around_small" style="border-bottom: 1px solid #dddbda;"></div> 
        </div>
        
        
        <aura:if isTrue="{!v.showSpinner}">
            <div class="slds-text-align_center">
                <div style="position: relative; display: inline-block; width: 80px; height: 80px;">
                    <lightning:spinner alternativeText="Loading" size="medium"/>
                </div>
            </div>
        </aura:if>
        
        <table class="slds-table slds-table_bordered slds-table_striped">
            <thead >
                <tr>
                    <th scope="col" class="slds-text-align_left"><span class="slds-truncate">Testeabc</span></th>
                    <th scope="col" class="slds-text-align_left"><span class="slds-truncate">Testeabc2</span></th>
                </tr>
            </thead>
            <aura:iteration items="{!v.deviceList}" var="item">
                <tbody>
                    <tr>
                        <td class="slds-text-align_left">{!item.phoneLineNumber}</td>
                        <td class="slds-text-align_left">{!item.phoneLineNumber}</td>
                    </tr>
                </tbody>
            </aura:iteration>
        </table>
        
        <div class="slds-align_absolute-center slds-p-top_small">
            <div class="slds-p-right_small">
                <button class="slds-button slds-button_brand" >Bloquear</button>
            </div>
            <button class="slds-button slds-button_brand" >Netlock</button>
        </div>
        
    </div>
</aura:component>
Controller :
({
    doInit : function(component, event, helper) {
        
        var id = component.get("v.recordId");
        var action = component.get("c.getDevice");
        action.setParams({"recordId":id});
        action.setCallback(this, function(response) {
            var state = response.getState();
            console.log(state);
            var retorno;
            if (state === "SUCCESS") {
                console.log('sucess2');
                retorno = response.getReturnValue();
                component.set('v.showSpinner', false);
                if(retorno != null) {
                    alert('notnull2');
                    component.set('v.deviceList',retorno);
                    console.log('Data Device');
                    console.dir(component.get('v.deviceList'));
                }else {
                    var toastEvent = $A.get("e.force:showToast");
                    toastEvent.setParams({
                        "title": "Erro", 
                        "type": "Error", 
                        "message": 'Não foi possível encontrar registros.'
                    });
                    toastEvent.fire();
                }
            }else{
                component.set("v.showSpinnerOthers", false);
                var toastEvent = $A.get("e.force:showToast");
                toastEvent.setParams({
                    "title": "Erro", 
                    "type": "Error", 
                    "message": 'Não foi possível encontrar registros.'
                });
                toastEvent.fire();
            }
        });
        
        $A.enqueueAction(action);
    }
})

Apex Controller:
public class CEC_360_Gadget_Controller {
    @AuraEnabled
    public static CEC_RestObjects.Device getDevice(String recordId) {
        CEC_RestObjects.Device device = new CEC_RestObjects.Device();
        Asset record = [SELECT Id, MSISDN__c FROM Asset WHERE Id = :recordId];
        if(record.MSISDN__c != null) {
            device = CEC_360_IntegrationDevices.generateMock();
            system.debug(device);
        }
        return device;
    }
    
}

Class to generate MOCK:
 
public class CEC_360_IntegrationDevices {
    
     public static CEC_RestObjects.Device generateMock() {
         CEC_RestObjects.Device device = new CEC_RestObjects.Device();
         CEC_RestObjects.Frequency frequency = new Cec_RestObjects.Frequency();
         frequency.modelFrequencyGenerationTechnology = '850 MHZ';
         frequency.modelGenerationTechnology = '3G';
         
         device.phoneLineNumber = '11 981277410';
         device.iccid = '8992101200003204510';
         device.imei = '352279018335277';
         device.modelName = 'Nokia N95';
         device.modelTechnology = 'GSM';
         device.frequencies = new List <Cec_RestObjects.Frequency> ();
         device.frequencies.add(frequency);
         device.manufacturerName = 'NOKIA';
         device.deviceStatus = 'LIBERADO';
         device.deviceStatusDate = '2010-01-01';
         device.deviceStatusReason = 'PERDA';
         device.serviceOperator = 'Claro';
         device.deviceSoldByClaro = true;
         device.directSale = true;
       
         return device;
       
    }

}
Wrapper Class
global without sharing class CEC_RestObjects
{
      public class Device {
        @AuraEnabled public String phoneLineNumber;
        @AuraEnabled public String iccid;
        @AuraEnabled public String imei;
        @AuraEnabled public String modelName;
        @AuraEnabled public String modelTechnology;
        @AuraEnabled public List <Frequency> frequencies;
        @AuraEnabled public String manufacturerName;
        @AuraEnabled public String deviceStatus;
        @AuraEnabled public String deviceStatusDate;
        @AuraEnabled public String deviceStatusReason;
        @AuraEnabled public String serviceOperator;
        @AuraEnabled public boolean deviceSoldByClaro;
        @AuraEnabled public boolean directSale;
     
    }
    
    global class Frequency {
       @AuraEnabled public String modelGenerationTechnology;
       @AuraEnabled public String modelFrequencyGenerationTechnology;
    }


 
Raj VakatiRaj Vakati
Can you let us know what is the error you are getting?  Can u check debug logs once