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
Archana JaladiArchana Jaladi 

Lightning issue--Uncaught Error in $A.getCallback() [system is not defined] Callback failed:


Hello Everyone,

I am calling an Apex function from helper but it is throwing the below error

This page has an error. You might just need to refresh it. Error in $A.getCallback() [Cannot read property 'set' of undefined] Callback failed: apex://ScheduleIn/ACTION$getTimeZones Failing descriptor: {c:ScheduleInEventDetails}
---.apxc---------------------
@AuraEnabled
    public static Map<String, String> getTimeZones(){
        return queryPicklistValues(User.TimeZoneSidKey.getDescribe());
    }        
    @AuraEnabled
    public static Map<String, Map<String, String>> getTimezonesAndlanguages(){
        Map <String, Map<String, String>> picklists = new Map <String, Map<String, String>>();
        picklists.put('languages', queryPicklistValues(Event.Language__c.getDescribe()));
        picklists.put('timezones', queryPicklistValues(User.TimeZoneSidKey.getDescribe()));
        return picklists;
    }
    public static  Map<String, String> queryPicklistValues(Schema.DescribeFieldResult fieldResult){
        Map<String, String> options = new Map<String, String>();
        //Schema.DescribeFieldResult fieldResult = Account.Industry.getDescribe();
        List<Schema.PicklistEntry> pList = fieldResult.getPicklistValues();
        for (Schema.PicklistEntry p: pList) {
            options.put(p.getValue(), p.getLabel());
        }
        return options;
    }
   
    @AuraEnabled
    public static List<DateTime> getWeeksAvailableTimeSlots(String lang, String reason, Decimal duration, DateTime dtime){
        //TimeZone tz = TimeZone.getTimeZone('America/Los_Angeles');
 -------Helper------
getTimeZoneDisplayName : function(cmp, timezoneName) {
        console.log('getTimeZoneDisplayName');
        var action = cmp.get("c.getTimeZoneDisplayName");
        action.setParams({timezoneName : timezoneName});
        
        action.setCallback(this, function(response) {
             if (response.getState() == "SUCCESS") {
                 cmp.set("v.timezoneDisplayName", response.getReturnValue()); 
                 
             }
        });
        $A.enqueueAction(action);
    },
-------Components---

<aura:component  controller="ScheduleIn">
    <aura:attribute name="bookedEventId" type="Id"  />
    <aura:attribute name="eventDetails" type="Event"  />
    <aura:attribute name="startTime" type="String"  />
    <aura:attribute name="endTime" type="String"  />
    <aura:attribute name="action" type="string" default="confirm" />
    <aura:attribute name="timezoneDisplayName" type="string" default="" />
    <aura:attribute name="timezoneValues" type="Map" default=""/>
    
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:registerEvent name="stepChange" type="c:ScheduleInStepChange"/>
    
    <form method="post" id="bookingConfirmationForm">
        <center style=""><Label class="Confirmationheading"></Label></center>
        <aura:if isTrue="{!v.action=='confirm' || v.action==''}">
            <center id="descEventDetails">
                <!---<img src="{!$Resource.ScheduleInTickIcon}" class="TickIcon" />-->
                <p class="ScheduleIn_BookingConfirmation" style="">{!$Label.c.ScheduleIn_Booking_Confirmation}</p>
                <!--<h1 style="color: purple;margin-top: -17px;">A Global HR Service Associate will call you during your scheduled appointment time.</h1>-->
            </center><br/>
        </aura:if>
        <aura:if isTrue="{!v.action!='confirm' &amp;&amp; v.action!=''}">
            <center id="descEventDetails">
                    <br/><br/><h5 style="color: #aa0061;font-size: 22px; font-family: brandon grosteque;margin-top: 10px;">{!$Label.c.ScheduleIn_Reschedule}</h5><br/>
            </center><br/>
        </aura:if>
        <!--<h4 style="margin-left: 251px; color: #470a68;font-size: 22px;font-family: brandon grosteque;"> Reschedule, Cancel and New Appointment </h4>-->
        <table  border="0" cellpadding="10"  class="formtable-3" id="userPreferencetable" >
            <tr>
                <td class="heading"><label class="mobile-view-confirmationnum"></label>{!$Label.c.ScheduleIn_Confirmation}</td>
                <td class="mobile-view-number" >{!v.eventDetails.What.Name}</td>
            </tr>
            <tr>
                <td class="heading"><label class="mobile-view-reason">{!$Label.c.ScheduleIn_Reason}</label></td>
                <td class="mobile-view-appointmentreason">{!v.eventDetails.Reason__c}</td>
            </tr>
            <tr>
               <td class="DescriptionIssue slds-col slds-size_1-of-3"><label style="align:center">{!$Label.c.ScheduleIn_Description}</label></td>
                <td class="Descriptionforissue">{!v.eventDetails.Description}</td>
            </tr>
            <tr>
                <td class="heading"><label class="mobile-view-status">{!$Label.c.Schedueln_Status}</label></td>
                <td class="mobile-view-confirmed" style=" color: green; font-weight: bold;"></td>
            </tr>
            <tr>
                <td class="heading"><label class="mobile-view-when">{!$Label.c.ScheduleIn_When}</label></td>
                <td class="mobile-view-time">{!'' + v.startTime + '(' + v.timezoneDisplayName + ')'}</td>
            </tr>
rambabu nrambabu n
Hi Archana Jaladi,

Can you provide full code with controller and full apex code.

Thanks & Regards,
Rambabu
UjwalaUjwala
hi,
if you have posted full code,,
lookes like you have called contrller method, var action = cmp.get("c.getTimeZoneDisplayName");
because in apex there is no getTimeZoneDisplayName method.