• kylew@mbs-us.co
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
I've been trying to figure this out for the last two days. I've gone through countless posts and I just don't see my problem. I've created a customobject called residual (residual__c). I've imported some data in to it. I've used the apex data loaded to verify that there is data in it. I then created an scontrol and put it on my accounts page layout but when the scontrol runs all I get is either null or undefined inside of the table cell.
 
Code:
<html> 
<head> 
<script src="/soap/ajax/9.0/connection.js"></script> 
<script>
function createTable() 
{
  var queryContact = sforce.connection.query("SELECT id,report_date__c,residual__c,gross_monthly_volume__c FROM residual__c where name='{!Account.AccountNumber}'");
  var records = queryContact.getArray("records"); 
  htmlstr="<TABLE width=100% class=pbBody border=0>"; 
  htmlstr+="<tr><TH>Report Date</TH><TH>Gross Monthly Volume</TH><TH>Residual</TH></TR>"; 
  for (var i = 0; i < records.length; i++) 
  { 
    htmlstr+="<tr>" +
             "  <td>" + records[i].report_date__c + "</td>" +
             "  <td>" + records[i].gross_monthly_volume__c + "</td>" +
             "  <td>" + records[i].residual_date__c + "</td>" +
             "</tr>";
  }
  htmlstr+="</TABLE>"; 
  document.write(htmlstr);
} 
</script>
</head>
<body onload="createTable();"></body>
</html>

 
I've also used records[i].get("report_date__c"), stored the data in variables, used the alert function, but all seems to give the same result. My data isn't pulling correctly. Can someone see what I'm doing wrong?
 
Thanks
 
Kyle