You need to sign in to do that
Don't have an account?
new developer.ax420
New developer question
Hello All,
I am new to SalesForce so forgive me if this is an easy question. This is driving me crazy. I am trying to query the a custom client object in salesforce from an s-control and display the results on a custom tab. I created the following code in an s-control and linked it to the tab page layout. Can someone point out flaws in my thinking? My current "stuck" point is that it never gets by the salesforce.connection.query statement (as the "after query" alert never shows up..the before query does show up). Is this a syncronous vs asynchronous issue? . Any general thoughts about my code are appreciated.
PS... I also realize I don't have any error code or anything in here right now. Trying to keep it simple until it works
<html>
<head>
<script src="/soap/ajax/10.0/connection.js" type="text/javascript"></script>
</head>
<body>
<script type="text/javascript">
alert("before query");
var result = sforce.connection.query("select Client__c.Name from client");
alert("after query");
var it = new sforce.QueryResultIterator(result);
while (it.hasNext()) {
var Name = it.next();
alert(Client__c.Name);
document.write(Client__c.Name);
}
</script>
</body>
</html>
I am new to SalesForce so forgive me if this is an easy question. This is driving me crazy. I am trying to query the a custom client object in salesforce from an s-control and display the results on a custom tab. I created the following code in an s-control and linked it to the tab page layout. Can someone point out flaws in my thinking? My current "stuck" point is that it never gets by the salesforce.connection.query statement (as the "after query" alert never shows up..the before query does show up). Is this a syncronous vs asynchronous issue? . Any general thoughts about my code are appreciated.
PS... I also realize I don't have any error code or anything in here right now. Trying to keep it simple until it works
<html>
<head>
<script src="/soap/ajax/10.0/connection.js" type="text/javascript"></script>
</head>
<body>
<script type="text/javascript">
alert("before query");
var result = sforce.connection.query("select Client__c.Name from client");
alert("after query");
var it = new sforce.QueryResultIterator(result);
while (it.hasNext()) {
var Name = it.next();
alert(Client__c.Name);
document.write(Client__c.Name);
}
</script>
</body>
</html>
Also, I recommend a few tools that help when developing SOQL queries and scontrols:
1. Force.com IDE (which includes schema browser): http://wiki.apexdevnet.com/index.php/Force.com_IDE
The schema browser helps you test and verify SOQL syntax
2. I develop SControls using Firefox so I can use some of the following developer plugins:
Firebug: https://addons.mozilla.org/en-US/firefox/addon/1843
Javascript Debugger: https://addons.mozilla.org/en-US/firefox/addon/216
Web Developer Toolbar: https://addons.mozilla.org/en-US/firefox/addon/60
I hope this helps you continue to get started.
Appreciated.
Message Edited by new developer on 12-30-2008 06:29 AM
Message Edited by new developer on 12-30-2008 07:07 AM
Message Edited by new developer on 12-30-2008 07:48 AM
Message Edited by new developer on 12-30-2008 07:48 AM