0

I have a visualforce page that I am using as a Custom Action on the CPQ Quote Line Editor page. I actually only need a lightning web component (lightning-record-form) but due to technological limitations I had to wrap the LWC in an aura component, and then wrap the aura component in a visualforce page in order to fire it from the Custom Action. Now I can't get the visualforce page (modal) to close! When I was previously using the aura component as a quick action on the Quote page I was able to close the modal with:

$A.get("e.force:closeQuickAction").fire();

But now I have had to set up a close function in the visualforce page, which is fired by sending an event. The event works fine and fires my closeParentFunction, but nothing I have tried in that function actually closes the modal visualforce page. I have, based on google searches, tried everything from window.close(), window.top.close(), etc etc.. it doesn't seem like anything I do will actually close the modal. This seems ridiculous that it is not documented and I'm not sure where to turn at this point. Suggestions welcome!!

<script>
    var closeParentFunction = function(event)
    {
        console.log('trying to close parent visualforce page');
        // some action here
    };
    $Lightning.use("c:LightningOutApp", function() {
        $Lightning.createComponent("c:newProductAddToQuoteLineModalAura",
        {
            quoteId : '{!$CurrentPage.parameters.Id}'
        },
        "newProductAddToQuoteLineModalAuraContainer",
        function(cmp) {
            console.log('Component created. QuoteId=' + '{!$CurrentPage.parameters.Id}');
            $A.eventService.addHandler({ "event": "c:closeParentEvent", "handler" : closeParentFunction});
        });
    });

Your Answer

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

Browse other questions tagged or ask your own question.