The issue is in the eventClick function where I'm trying to invoke the apex controller method-getDataEventss(). The action call state is not got printed in console which means its not getting executed but I'm not sure why its not getting executed. Any solution or suggestio plz..

CalendarView.cmp :

<ltng:require styles="/resource/gpcal_lex_yo_SLDS0121/assets/styles/salesforce-lightning-design-system-ltng.css,/resource/gpcal_lex_yo_fullcalendar/fullcalendar-2.6.0/fullcalendar.css" 



<aura:attribute name="cal" type="Boolean" default="true" />
<aura:attribute name="evtRec" type="List" />
<aura:attribute name="eventId" type="String" />

 <aura:renderIf isTrue="{!v.cal}">
    <div id='calendar'>
    <!-- <c:EventsList evtId="{!v.eventId}" /> -->

<table class="slds-table slds-table--bordered slds-table--striped slds-table--cell-buffer slds-table--fixed-layout">
  <tr class="slds-text-heading--label">
    <th scope="col"><div class="slds-truncate" title="ID">ID</div></th>
    <th scope="col"><div class="slds-truncate" title="Subject">Subject</div></th>
    <th scope="col"><div class="slds-truncate" title="StartDateTime">StartDateTime</div></th>
  <!-- Use the Apex model and controller to fetch server side data -->
  <aura:iteration items="{!v.eventData}" var="e">
      <th scope="row"><div class="slds-truncate" title="{!e.Id}">{!e.Id}</div></th>
      <td><div class="slds-truncate" title="{!e.Subject}">{!e.Subject}</div></td>
      <td><div class="slds-truncate" title="{!e.StartDateTime}">{!e.StartDateTime}</div></td>
        <form class="account-form" onsubmit="{!c.deleteAccount}">
          <input type="hidden" value="{!e.Name}" class="account-name" />

           <!--  Use a Lightning Base Component
            To display an icon next to the label-->

          <lightning:button label="Delete"


doInit: function(component, event, helper){
        defaultView: 'month',
        allDaySlot: false,
        selectable: true,
        selectHelper: true,
        select: function(start, end) {

            var title = prompt("Please enter subject of event:");
            var eventData;
            if (title) {

                var action = component.get("c.createNewEvent");
                var params = { 
                    start_time : start.format("YYYY-MM-DD HH:mm:ss"),
                    end_time   : end.format("YYYY-MM-DD HH:mm:ss"),
                    user_id    : component.get("v.user_id"),
                    what_id    : component.get("v.recordId"),
                    sobjectName    : component.get("v.sObjectName"),
                    title      : title      

                action.setCallback(this, function(actionResult) {                                               
                    if( actionResult.getReturnValue() ){
                        $('#calendar').fullCalendar( 'refetchEvents' );
                        console.log("save successful");

                        alert( "Save failed for some reason." );


        events: function(start, end, timezone, callback) {
            var user_id = component.get("v.user_id");               
            var action = component.get("c.getEvents");
                    start_time : start,
                    end_time   : end,
                    user_id    : user_id        

            action.setCallback(this, function(actionResult) {
        eventClick: function(calEvent, jsEvent, view) {
            console.log('gm calEvent '+calEvent);
            console.log('gm1 '+calEvent.id);
            var evtId = calEvent.id;
            //var evt = $A.get("e.harshabr:ResultEvent");
            //evt.setParams({ "pass_result": evtId });
            var action = component.get('c.getDataEventss');
                "eventId": evtId
            // Set up the callback
            action.setCallback(this, function(actionResult) {
                component.set('v.eventData', actionResult.getReturnValue());


Apex Controller method :

public static List<Event> getDataEventss(string eventId){
    system.debug('GM eventId '+eventId);
    if(eventId != null && eventId != ''){
        return [SELECT Id,Subject,StartDateTime FROM Event where Id =: eventId];
        return [SELECT Id,Subject,StartDateTime FROM Event limit 10];
  • If you added some error, exception handling and some debug info, it would be easier to help, however, lacking any debug info and error messages, you are basically asking for a code review. Please update your post with relevant data and a specific problem. Thanks
    – glls
    Feb 7 '18 at 12:33
  • Sorry, The issue is at eventClick function where I'm calling apex controller method - 'getDataEventss' to get the event details by passing event Id. But this action seems to be not executed since I dont see any log on state of action.
    – Manu
    Feb 7 '18 at 12:57
  • In eventClick function make a server call wrap inside $A.getCallback()
    – vignesh
    Feb 7 '18 at 13:44
  • Thank you. I wrap up the server call inside $A.getCallback() but still having same issue. Checked the debug log in salesforce & the call to apex method didn't happen.
    – Manu
    Feb 8 '18 at 8:21

Do not use $A.run. It doesn't actually run anything, but instead creates a lifecycle callback, which you still need to call separately. Also, as mentioned in the documentation, its use is deprecated, and should not be used at all.


Should be:

  • Thank you. I have fixed it by using $A.getCallback() in select function since salesforce deprecated $A.run(). I'm facing issue in eventClick function where I wrap the server call inside $A.getCallback() but it seems its not get executed as i checked in salesforce debug log for that apex method
    – Manu
    Feb 8 '18 at 8:24

I was having the same issue. I found this code using Promises and was able to get the eventDrop functionality to update my SF org with the dragged event.

$A.enqueueAction not being executed when using lightning out

This code may help you out, too, by using the editEvent method as the author does: https://blogs.absyz.com/2018/07/12/custom-calendar-lightning-component/

My code is as follows (notice I use String for the StartDateTime for the Apex class parameter):

editEvent : function(component, eventId, eventDate) {

    // Using promises
    // https://salesforce.stackexchange.com/questions/224535/a-enqueueaction-not-being-executed-when-using-lightning-out
    // https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/js_promises.htm

    return new Promise($A.getCallback(function (resolve, reject) {

        var action = component.get("c.updateDraggedEventDB");

        console.log('eventId: ' + eventId);
        console.log('eventDate: ' + eventDate);

             "eventId"      : eventId
            ,"startDtTm"    : eventDate

        console.log('action: ' + action);
        console.log('Begin setCallback');

        action.setCallback(this, function(response) {
            var state = response.getState();
            console.log('response getState: ' + state);
            if (component.isValid() && state === "SUCCESS") {
                console.log('returnValue: ' + response.getReturnValue());
            } else {
                console.log('Error trying to create event:' + response.state);

        console.log('Begin enqueueAction');                  

Apex call:

    // Update the calendar event startdate in Salesforce after it is moved on the calendar
public static Event updateDraggedEventDB(Id eventId, String startDtTm){

    System.debug('In Apex class...');
    System.debug('eventId: ' + eventId);
    System.debug('startDtTm: ' + startDtTm);

    // Create a new Event to store the updated Event information 
    Event draggedEvent = [SELECT Id, StartDateTime FROM Event WHERE Id = :eventId];

    // Update the incoming startDtTm (a String value) to a DateTime value that the calendar can handle        
    draggedEvent.StartDateTime = DateTime.Valueof(startDtTm.replace('T', ' '));

    System.debug('draggedEvent: ' + draggedEvent);

    // Update SF with the moved Event info
    update draggedEvent;        
    System.debug('draggedEvent: ' + draggedEvent);
    return draggedEvent;
  • Thanks for the sample. It helped me resolve my issue Jun 10 at 12:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.