0

I have been trying load a visualforce page using an iframe on an external company website. I have followed all the documentation to the best of my ability without luck. I understand that I must use Lightning Out and at a minimum there should be three files. Using a simple "Hello World" component here is what I have so far. I can not seem to get past first base with this - which to simply preview the app. Help would be awesome. I have spent a few days on this. Although I'm only a lowly admin I do have years of experience in building web apps with php and Mysql - So none of this is over my head - I hope. Thank you in advance for any help you can offer.

myAppContainer.app

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

myAppComponent.cmp

<aura:component>
<h1>Hello World</h1>
</aura:component>

myAppVF.vfp

<apex:page >

<apex:includeLightning />

<div id="lightningLocator">

</div>
<script>
$Lightning.use("c:myAppContainer",    // I believe this one is correct
    function() {                  // Callback once framework and app loaded
        $Lightning.createComponent(
            "c:myAppComponent", // I believe this one is correct
            { },                  // attributes to set on the component when created
            "lightningLocator",   // Not Sure about this one -the DOM location to insert the component
            function(cmp) {
                // callback when component is created and active on the page
            }
        );
    },
               'https://NotSureAboutThisOne/'  // I have no idea what this is supposed to be. Community endpoint
);
</script>
</apex:page>

When the app is previewed I get the following: enter image description here

  • oh and I am pretty sure I will have to load this into a community page using Site Guest User profile so there will not have to be a login. – John Tracey Sep 7 at 17:01
  • what url do you use to preview the app? – Guy Clairbois Sep 7 at 18:42
  • since you've developed it as a Lightning Out app, you have to view it from a Lighting Out perspective, i.e. in the visualforce page. The correct url would be mytattoostory-dev-ed.lightning.force.com/page/myAppVF – Guy Clairbois Sep 9 at 8:24
0

I'd advise to start without the 'https://NotSureAboutThisOne/' line. I expect that that will allow you to preview the visualforce page (all the rest looks fine to me).

The url parameter is the URL for the Lightning domain on your Salesforce instance. For example, https://myDomain.lightning.force.com. I doubt if this is actually necessary. Previewing the visualforce page (while being logged in) works fine for me when leaving it empty.

It might be necessary once you've set up your community and assigned it public access. Do note that you need a community of type 'Salesforce Tabs + Visualforce' to use this kind of visualforce pages.

  • Thanks! I'll get on this and let you know what happened. – John Tracey Sep 7 at 21:29
  • Did not work. Either way. – John Tracey Sep 7 at 21:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.