Activity Forums Salesforce® Discussions How to pass record id from VF page to lightning component in Salesforce?

  • Marziya

    Member
    June 12, 2020 at 1:44 pm

    Hii Anuj,
    You can use following code format:-
    var recordId = '{!customObject__c.id}';
    $Lightning.use("c:customObjectEditApp", function() {
    // Attributes are passed to the new component as a name/value hash
    var attributes = {
    recordId: recordId
    };
    var targetElementId = 'customObjectEdit';
    // Create the component with the supplied attributes
    $Lightning.createComponent('c:customObjectEdit', attributes, targetElementId, function(cmp) {
    // At this point the component has been created and loaded
    });
    });

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos