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
Haseeb Ahmad 9Haseeb Ahmad 9 

Issue while calling to Lightning (Aura) Component from VF page

Hello I need help to figure out when the VF page is not able to call the Lightning component correctly 

Following this article: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_visualforce.htm

https://developer.salesforce.com/forums/?id=9060G0000005jWmQAI

When I make a call I am able to launch the lightning component in the VF page but if I click any button it Is not working and I am getting this error.

User-added image
When I click the cancel button it should redirect me back to the opportunity record page but it not happening.

If I use that lightning component in a quote action it works perfectly but not when I call from the VF page. 

any thought? 
ANUTEJANUTEJ (Salesforce Developers) 
Hi Haseeb,

Can you post a sample snippet that can be checked in our demo org so as to look further and respond.

Thanks.
Haseeb Ahmad 9Haseeb Ahmad 9
Hi Anutel,

Thank you for your help.

Here is the code for the VF page and application.

VF page: 
 
<apex:page controller="OpportunityTriggerHandlerHelper" sidebar="false" showHeader="false" standardStylesheets="false" >
    <apex:includeLightning />

    <div id="createScopingRequest"></div>

    <script>    
        $Lightning.use("c:scopingRequest", function() {
            $Lightning.createComponent("c:CaseCreationOpportunity",
                    {},
                    "createScopingRequest",
                    function(cmp) {
                        console.log('App is working');
                    });
            
        });
    
    </script>
</apex:page>

Application: 
 
<aura:application extends="ltng:outApp" access="global" >
    <c:CaseCreationOpportunity/>
</aura:application>

Please let me know if you need code for the lightning component as well thank you.