Load a Visualforce Page with Parameters in Lightning - Component Code

PHOTO EMBED

Fri Aug 16 2024 15:48:19 GMT+0000 (Coordinated Universal Time)

Saved by @shawnclevinger

    doInit : function(component, event, helper) {
        var params = new Array();
        params.push(component.get('v.recordIdVar') + '=' + component.get('v.recordId'));
        params.push(component.get('v.otherParams'));
        component.set('v.queryString', params.join('&'))
    },

    openPage : function(component, event, helper) {

        // Show spinner once button is pressed
        var spinner = component.find('spinner');
        $A.util.removeClass(spinner, 'slds-hide');

        // Build url for Visualforce page
        var vfURL = 'https://' + component.get("v.domain") + '--c.visualforce.com/apex/';
        vfURL = vfURL + component.get("v.pageName") + '?';
        vfURL = vfURL + component.get("v.queryString");
        console.log("VF URL: ",vfURL);
content_copyCOPY

https://unofficialsf.com/load-a-visualforce-page-with-parameters-in-lightning/