Custom List View Button In Salesforce

Step 1. Create a button on Visualforce Page:

Step 2. Create a VF Page with Like :

<apex:page standardController="TimeSheetEntry" lightningStylesheets="true" recordSetVar="TimeSheetEntry">        

   <apex:includeLightning />

    <div id="LightningContainer" />

    <script>

    var parentRecId = "{!$CurrentPage.parameters.id}";

        $Lightning.use("c:soldToAndShipToApp", function() {

            $Lightning.createComponent(

                "c:soldToAndShipToCmp",

                {"parentRecId":parentRecId},

                "LightningContainer",

                function(component) {

                    console.log("Component is created!");

                    console.log(component);

                    console.log('@#@# '+parentRecId);

                });

            });        

      </script>

</apex:page>


Step 3. Create a aura-application :

<aura:application extends="ltng:outApp" access="global">

    <aura:dependency resource="c:newTimeSheetEntryOverride"/> 

    <c:newTimeSheetEntryOverride/>

</aura:application>


Step 4. Create a aura cmp :


<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,lightning:isUrlAddressable,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global">

    <aura:attribute name="RecordID" type="String"/>

    <aura:attribute name="parentRecId" type="String"/>

    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>

    <lightning:card title="Lightning Aura Component">

        <div class="slds-p-around_small">

            Current Record ID in Lightning Aura Component: <strong>{!v.recordId}</strong> <br/><br/>

        </div>

    </lightning:card>

</aura:component>

-------------------------------------------------

<apex:page standardController="Agent__c" lightningStylesheets="true" recordSetVar="Agent__c">
<apex:includeLightning />
<div id="LightningContainer"></div> 

    <script>
        var parentRecId = "{!$CurrentPage.parameters.id}";

        $Lightning.use("c:createAgentAuraApp", function() {
            $Lightning.createComponent(
                "c:createAgentAuraCmp",
                { "parentRecId": parentRecId },
                "LightningContainer",
                function(component) {
                    console.log("Component is created!");
                    console.log(component);
                    console.log("Parent Record ID: " + parentRecId);
                }
            );
        });
</script>
</apex:page>

----------------------------------------------------------------------------------------

<aura:application extends="ltng:outApp" access="global">
<aura:dependency resource="c:createAgentAuraCmp"/> 
<c:createAgentAuraCmp/>
</aura:application>

----------------------------------------------------------------------------------------

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,lightning:isUrlAddressable,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global">
<aura:attribute name="recordId" type="String" />
<aura:attribute name="parentRecId" type="String" />

 

    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />

<c:agentQuickActionForm record-id="{!v.recordId}" parent-rec-id="{!v.parentRecId}" />

</aura:component>

 ----------------------------------------------------------------------------------------

({
  myAction : function(component, event, helper) {

  },
    doInit : function(component, event, helper) {
        alert('call');
        // Initialization code
    }
})

 

Comments

Popular posts from this blog

Get Record Id RecordId in LWC

PDF LWC (Link for pdf liabrary)