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
Satish InugantiSatish Inuganti 

Lightning Application Event Catch in Visualforce Page

Hello Team,

I have a lightning component which i have embedded on Visualforce Page using the Lightning Out App. The lightning component produces an event which needs to be catched in Visualforce. For that I have created an APPLICATION Event and handled in the below way. But the catch handler is not getting executed or not calling the VF Handler. Can anyone please help what is wrong here? I have tried to debug but couldn't able to see any errors in chrome console.

$Lightning.use("c:CPQB_ExtConfigApp", function() {
                                $Lightning.createComponent("c:CPQB_ExtConfig", {
                                    configData: message,
                                    data: productOptionsData
                                }, "ext-config", function() {
                                    $A.eventService.addHandler({
                                        "event": "c:ConfigEvent",
                                        "handler": broadcast
                                    });
                                });
                            });
ShivankurShivankur (Salesforce Developers) 
Hi Satish,

The code posted looks good to me.

Following type of syntax should do the trick:
$A.eventService.addHandler({ "event": "c:ConfigEvent", "handler" : broadcast});
However, you can verify implementing each and every component from example given on below link, since it works fine:
https://www.soliantconsulting.com/blog/lightning-events-visualforce-page/
https://www.biswajeetsamal.com/blog/fire-events-from-lightning-component-and-handle-in-visualforce-page/

If you still see the issue, log a case directly with Salesforce Support to debug specific to events fire or catch action,if it doesn't work as intended for you.

Hope above information helps, Please mark as Best Answer so that it can help others in the future.

Thanks.