You need to sign in to do that
Don't have an account?
kylew@mbs-us.co
Query CustomObject in scontrol
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:
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?
<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
You can also see what the query returned by going to the debugshell:
1. log in as the right user
2. go to /soap/ajax/10.0/debugshell.html
3. type your query and hit return: Debug shell will display the result as a table.
field_name is case sensitive. So make sure that you are using the right case.