1

Scenario:

My .NET-based application is deployed on some other application server (not Heroku). I have put the following JavaScript code on my .NET application page:

<script type="text/javascript" src="https://na5.salesforce.com/canvas/sdk/js/29.0/canvas-all.js"></script>
<script>
var sr;
function httpGet()
{
    xmlHttp = new XMLHttpRequest(); 
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4) {
           alert(" xmlHttp.responseText = " +  xmlHttp.responseText); 
          sr = xmlHttp.responseText;
        }
    }
    xmlHttp.open( "GET", "https://sfcanvassdk.herokuapp.com/mi", true );
    xmlHttp.send( null );
}

httpGet();

function submitform()
{
  //document.myform.submit();
  //var oppName = document.getElementById("oppnm");
  //alert(oppName.value);
  Sfdc.canvas.client.publish(sr.client, {name : "mi.oppNameChanged", payload : {name : "Test 123321"}});
}

setTimeout(function(){
   alert('Sfdc = ' + Sfdc);
   var outStr = '';
   for (n in Sfdc )
   {
       outStr += 'n = ' + Sfdc[n] + '\n';
   }
   alert(outStr);
   Sfdc.canvas(function() {
      alert(sr);
    sr = JSON.parse(sr);
    // Save the token
    Sfdc.canvas.oauth.token(sr.oauthToken);
       alert('calling sfdc.canvas function def');
    //Sfdc.canvas.byId('username').innerHTML = sr.context.user.fullName;
});
    submitform();

    var ctxlink = Sfdc.canvas.byId("ctxlink"); 
    var client = Sfdc.canvas.oauth.client();


}, 5000);

</script>

When i try to access that .NET page I get the follwong error:

canvas-all.js:825 Uncaught #.

Pramod Kumar
  • 5,300
  • 15
  • 58
  • 85
  • If you use your browser's developer console you should be able to get more information such as a line numbers and also breakpoint and debug if necessary. Looking in canvas.all.js there are only 4 push calls and the file is not obfuscated. – Keith C Jul 02 '15 at 08:15
  • Thanks @KeithC for reply. We replaced this canvas.all.js with latest one so this Push error get resolved but came accross with new one - Uncaught # at line 825 - canvas-all.js:825 Uncaught #. Can you please suggest something – Pramod Kumar Jul 02 '15 at 10:05
  • My suggestion is that you treat this as an opportunity to learn about the very powerful debugging tools sitting there in your browser... – Keith C Jul 02 '15 at 10:30

0 Answers0