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
srividya UIsrividya UI 

Lightning App in custom button

HI,
I developed one lightning app. I want this app can be opened when click on custom button on Account.
So, how to the open lightning app when click on custom button on Account detail page.
sfdcMonkey.comsfdcMonkey.com
hi srlvldya
i also try this but there is no way to add direct lightning app on custom button on Account detail page. but i achieve this by create a visualforce page and add lightning app on that visualforce page after that add your visualforce page as Content Source of custom button
for add lightning app to vf page follow below link
http://peterknolle.com/lightning-components-in-visualforce/
i hop its helps you
Please Mark it best answer if it helps you so it make proper solution for others
Thanks
alsinan nazimalsinan nazim
Hi Srividya,

Currently there is no way to fire out a Lightning App from a button component on any SF pages. But you can do as Piyush Said. As you created the app, you can create a Visualforce page and integrate your app in the same page using Lightning:Out Method. In this way you can view and access the same app but using the VF page and you can call the same page from a custom button or link.
In you Lightning App Page write two extra lines:
 
<aura:application access="global" extends="ltng:outApp">
    <aura:dependency resource="c:yourComponentName"/>
    <c:yourComponentName ></c:yourComponentName>
</aura:application>

Here c is used as default namespace, if your Org has one put that there.

and in the VF page,
 
<apex:page>
 <apex:includeLightning />
 <apex:includeScript value="/lightning/lightning.out.js"/>
 <script>
    //Tell your Visualforce page to use your Lightning app
    $Lightning.use("c:yourLightningAppName", function() {

        // Write a function that creates the component on the page
        $Lightning.createComponent("c:YourComponentName",
                                   {},
                                   "divid",
                                   function(cmp) {      
                                   });
    });
    </script>
    <body>
        <div id="divid" />
    </body>
    
</apex:page>


Here divid is the id of the div where your Lightning App has to be loaded in the VF page.

Hope that helps,

Regards,
Alsinan
Amrit JainAmrit Jain

Just add a URL Button and in URL put 

/c/APP_NAME.app