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
Andrew Aldis 15Andrew Aldis 15 

$A.get("e.c:ModalEvent"); coming back undefined

I am trying to retrieve a lightning component from another component.   however when I try it comes back as undefined.  I have used this code in other components and it works but I  cannot see why it is not working with this one.  Am I overlooking something?


code:
viewAllActivities: function(component, event, helper) {
    console.log('modalEvent 1 clicked');
    var modalEvent = $A.get("e.c:ModalEvent");
    console.log('modalEvent 1 ' + modalEvent);
    modalEvent.setParams({
      "modalName": "c:retailDashboard_SellRed_Modal",
      "modalAction": "open",
      "modalData": {
        "parentId": ""
      }
    });
    console.log('modalEvent 2 ' + modalEvent);
    modalEvent.fire();
  },

Modal
<aura:event type="APPLICATION" description="Event to control modals within the OFI_ModalManager">
    <aura:attribute name="modalName" type="String" description="Name of the Modal to be affected."/>
    <aura:attribute name="modalAction" type="String" description="Action to be performed: Open, Close."/>
    <aura:attribute name="modalData" type="Object" description="An object containing data to be passed to the Modal."/>
</aura:event>
Raj VakatiRaj Vakati
Even name is c:ModalEvent or c:Modal ??  Are you testing in Lightning app or any other place ? 
You code looks good for me .. 
 
Andrew Aldis 15Andrew Aldis 15
It is ModalEvent I just labeled it modal for this forum.  What do you mean by am I testing in a lightning app?  
Raj VakatiRaj Vakati
What do you mean by am I testing in a lightning app -- YES
Andrew Aldis 15Andrew Aldis 15
Yes
 
Raj VakatiRaj Vakati
DO you have any namespace ?