• rambabu n
  • NEWBIE
  • 4 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies

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>
Hi,

I'm calling a existing component using create component and trying to pass attribute for it.
oneController.js
var id='25978371';
        $A.createComponent(
            "c:InDetails",
            {
                oppId: id,
            },
            function(newCmp){
                    component.set("v.currentContent", newCmp);
            }
        );
InDetails.cmp
<aura:attribute name="oppId" type="String"/>
InDetailsController.js
console.log(component.get("v.oppId"))

Indeatails components gets created in component one but console.log of oppId gives me undefined. I couldn't pass the attribute from one component to another.  
 
Helloo, 

Can you help me to achieve this requirement ?

How can I pre-fill a field in a lightning form with value entered in salesforce (Account object)
      <lightning:input name ="myField "value="{!v.account.myField}"  />

 
  • December 30, 2019
  • Like
  • 0