3

Based on latet Spring 17 release notes, https://releasenotes.docs.salesforce.com/en-us/spring17/release-notes/rn_lightning_apps_public.htm

I am trying to display lightning component in sites. I have a sample lightning component, visualforce page showing the component and a public site. Visualforce page is added to the site. When I preview the site as admin, nothing is shown on the visualforce page and it is blank.

Below is my sample

App

<aura:application access="GLOBAL" extends="ltng:outApp" implements="ltng:allowGuestAccess">
    <aura:dependency resource="c:mySampleComponent"/>
</aura:application>

Component

<aura:component >
    <ui:outputText value="This is a sample lightning component" />        
</aura:component>

Visualforce Page

<apex:page showHeader="false" sidebar="false">
    <apex:includeLightning />


    <div id="lightningComp"/>
    <script>
        $Lightning.use("c:mySampleApp", function() {
          $Lightning.createComponent("c:mySampleComponent",
          { },
          "lightningComp",
          function(cmp) {
            // do some stuff
          });
        },'SITE URL GOES HERE'

      );

    </script>

</apex:page>

Any insight on this would be very helpful.

1 Answer 1

6

You will need to enable Salesforce communities to get it working .The docs clearly mentions that for lightning out to work for guest users you need Salesforce communities enabled .

Also any error will show up in browser console .Open console and look for errors .

3
  • I need a page that will only be accessed by guest users. There will be no login involved. Does it make sense to use communities for this ?
    – apn
    Jan 26, 2017 at 13:29
  • 1
    Yes sure .You can still use communities .The problem here is simple salesforce allows lightning out only in communities enabled org .Hope that helps you Jan 26, 2017 at 15:57
  • 1
    I was able to do this using communities as suggested by Mohith. Thanks Mohith!!
    – apn
    Jan 27, 2017 at 4:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .