2

I have added lightning app into visualforce page i am getting error like "Something has gone wrong. Cannot read property 'length' of null. Please try again." could some one help me on this.

I have created simple application called "CanvasLightning" and created component called "CanvasLightningcomp".

CanvasLightning.app

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

CanvasLightningcomp.cmp

<aura:component >
  <force:canvasApp developerName="ICM" namespaceprefix="" width="999" height="400" maxHeight="infinite" maxWidth="infinite" parameters='{"ICMRequest":[{"sysId":null,"sObjplural":null,"showBreadCrumb":false,"redirectUrl":null,"operation":"ViewList","inputJSON":null,"entityType":"Contract","entityName":null,"contractTypeName":null,"clientName":"Salesforce"}]}'/>
  <h1>Hello Canvas</h1>
</aura:component>

I have added this lightning app into visualforce page like this:

<apex:page >
<apex:includeLightning />    
<!-- <apex:includeScript value="/lightning/lightning.out.js" /> -->
<script>
    //var baseUrl = 'https://icmsfdemo-dev-ed.lightning.force.com'; 
    $Lightning.use("c:CanvasLightning", function() { 
        $Lightning.createComponent(
        "c:CanvasLightningcomp",
        {},
        "lightningCanvas",
      function(cmp) {
        console.log('comp loaded' +cmp);
      });
    });
</script>    
<div id="lightningCanvas" />
</apex:page>

Finally when try to access the page, getting following Error: enter image description here

Looking forward to get some help on it.

Thnaks

0

Please use the native Visualforce component for this instead.

https://developer.salesforce.com/docs/atlas.en-us.platform_connect.meta/platform_connect/canvas_app_vf_component_ref.htm

  • Doug, Thanks for your response, but the native apex page is not supporting resizing of canvas in lightning UI. when we see this page in lightning, at that time the content is hidden, or there are multiple scrollbars. Well Its working with SF classic UI without any issue. And it is something which need to integrate with lightning importantly. – Sreenivas Kotapati Mar 28 '16 at 12:08
  • @SreenivasKotapati Why don't you directly drag the component than having it again lightning out – Mohith Shrivastava Mar 28 '16 at 16:27
  • @MohithShrivastava Can you please elaborate that what do you mean? – Sreenivas Kotapati Mar 29 '16 at 7:01
  • Using the force:canvasApp component inside of a Visualforce page via LC for Visualforce bridge is not a configuration that has been tested AFAIK because VF already has a native component for this. If the apex:canvasApp VF component is not functioning correctly for you please open a case on that. Getting force:canvasApp working inside of VF is likely to be given a very low priority. – Doug Chasman Mar 30 '16 at 11: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.