I'd like to fire 2 events at a time but it only executes the first .fire() method. I've got 2 events for showing and hiding of multiple lightning components. Can anyone suggest if how can I implement this in another way? Thanks.

    onChange : function(component, event, helper) {
        var CaseEvent1=component.getEvent("ShowAccountInfoEvent");
        alert('CaseEvent1: ' +CaseEvent1);
        var CaseEvent2=component.getEvent("ShowEnhancedAccountSearchEvent");
        alert('CaseEvent2: ' +CaseEvent2);

Given no errors occur, both events should fire. I know that I have indeed fired off multiple events in a single function, and both worked as expected. I would recommend using the Salesforce Lightning Inspector to see if the events are logged and their parameters. It's possible that the second component isn't handling the event properly, but without some debugging, it'd be hard to tell just from the information available in your question.

  • Hi sir. The above code was working just fine after I reviewed it. The attribute's name that I declared in the event was CaseEnhancedAccountSearchEvent and not EnhancedAccountSearchEvent. I just changed it and it's working now. Thanks for confirming also that not just one event can be fired at once. Thank you. :) – Crizzy Angel Apr 6 at 14:16

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.