function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dman100Dman100 

'sObjectType' not specified

I'm getting the following error when I run the an s-contro:
 
uncaught exception: arg 1 'sObjectType' not specified
newConnection()connection.js (line 659)
send("<se:Envelope xmlns:se="http://schemas.xmlsoap.org/soap/envelope/"><se:Header xmlns:sfns="urn:partner...", Object, false)connection.js (line 669)
_invoke("query", [Object name=queryString], false, undefined, [Object ns=urn:partner.soap.sforce.com, Object ns=sobject.partner.soap.sforce.com prefix=ns1], "/services/Soap/u/8.0", "urn:partner.soap.sforce.com", "sobject.partner.soap.sforce.com")connection.js (line 1573)
invoke("query", [Object name=queryString], false, undefined)connection.js (line 1516)
query("Select Candidate__c From Job_Application__c Where Position__c = 'a014000000B428U'", undefined)connection.js (line 1272)
doQuery()servlet.Integrati... (line 65)
 
Here is the s-control:
 
<html>
<head>
<style type="text/css">
#mapContainer {
height: 475px;;
width: 600px;
}
</style>

<script language="javascript" src="/soap/ajax/8.0/connection.js"
type="text/javascript"></script>
<script type="text/javascript"
src="http://api.maps.yahoo.com/ajaxymap?v=3.0&amp;appid=salesforce.com">
</script>

<script type="text/javascript">
var conn;
function initPage() {
conn = sforce.connection;
loadMap();
}

var reload = true;
var map;
var link;
var geoPoints = [];
var dataPointCount = 0;
var pointCounter = 0;

function geoCodeEnd(r) {
if (r.success == 1) {
if (r.GeoPoint.Lat != 0) {
geoPoints[geoPoints.length] = r.GeoPoint;
pointCounter++;
}
} else {
pointCounter++;
}
if (pointCounter >= dataPointCount) {
var bestZoomLevel = map.getZoomLevel(geoPoints);
if (bestZoomLevel < 5) bestZoomLevel = 5;
var geoCenter = map.getCenterGeoPoint(geoPoints);
map.drawZoomAndCenter(geoCenter, bestZoomLevel);
map.panToLatLon(geoCenter);
}
}

function loadMap() {
// Create a map object
map = new YMap(document.getElementById('mapContainer'));
// Display the map centered on given address
YEvent.Capture(map, EventsList.onEndGeoCode, geoCodeEnd);
map.addZoomLong();

doQuery();
}

function doQuery() {
if (reload == false) return;
var positionId = "{!Position__c.Id}";
var qr = conn.query("Select Candidate__c From Job_Application__c Where Position__c = '" + positionId + "'");
if (qr.size > 0) {
var ids = [];
var records = qr.getArray("records");
for (var i=0;i<records.length;i++) {
ids[i] = records[i].get("Candidate__c");
}
conn.retrieve("Id, Last_Name__c, First_Name__c, Street__c, City__c, State_Province__c, Current_Employer__c,Candidate__c, ids, plotMarkers");
} else {
// Display map of US if no Candidates found
var myPoint = new YGeoPoint(40,-95);
map.drawZoomAndCenter(myPoint, 14);
alert("There are no candidates for this position to map.");
}
reload = false;
}

function doNav(arg) {
window.parent.location = "/" + arg;
}

function plotMarkers(qr) {
var records = qr;
if (qr.getArray) {
records = qr.getArray("records");
}
var counter = 1;
if (records.length > 0) {
for (var x=0;x<records.length;x++) {
var db = records[x];
if (db.get("Street__c") != null && db.get("City__c") != null && db.get("State_Province__c") != null ) {
dataPointCount++;
var addr = db.get("Street__c") + ", " + db.get("City__c") + ", " + db.get("State_Province__c");
var marker = new YMarker(addr);
marker.addLabel(counter);
var name = db.get("First_Name__c") + " " + db.get("Last_Name__c") ;
counter++;
name = "<a href='" + conn.describeSObject("Candidate__c").urlDetail.replace("{ID}", db.get("Id")) + "' target='_top'>" + name + "</a>";
marker.personName = name;
YEvent.Capture(marker, EventsList.MouseClick,
function() {this.openSmartWindow
("<div>This is where " +
this.personName +
" lives!<BR>&nbsp;</div>") });
map.addOverlay(marker);
}
}
}

}


</script>


</head>

<body onload="initPage();">
<div id="mapContainer"></div>

</body>
</html>
Dman100Dman100
As a follow-up...I debugged in Firebug and set the page to break on all errors.  The connection is null.
 
this.connection = new ActiveXObject('Msxml2.XMLHTTP');
 
When I stepped into each line the catch error line showed that
Reference Error: ActiveXObject is not defined message = ActiveXObject is not defined.
 
The connection is called within this script:
 
<script language="javascript" src="/soap/ajax/8.0/connection.js" type="text/javascript"></script>
 
Can anyone help?
Dman100Dman100

Anyone have any ideas?  This was an example that came straight out of the SalesForce Creating On-Demand Applications: An Introduction to the Force.com Platform guide...page 233.

jpizzalajpizzala
Instead of having a variable hold sforce.connection, have you tried using the full call for your connection needs? i.e. sforce.connection.query( "select id from account" ) as opposed to conn.query( "select id from account" )?
Dman100Dman100
Thanks for replying to my post.
 
I tried your suggestion and used the full call to the connection.  I still recieved the same error.  When I debugged, the error was thrown on a line in the connection.js file that is looking for an ActiveXObject that is missing?  I have no idea where or how to get the missing ActiveXObject needed for this s-control to work?
 
Any SF folks know what is needed for this to work?
JimmmyJimmmy
Haveyou tired <script src="/soap/ajax/10.0/connection.js"></script> insted?
Dman100Dman100

Hi Jimmmy,

Yes, I tried several different versions of the API, including version 10.0.

Still, I get teh same error??

It is rather vexing that an actual code example straight out of one of SalesForce's books doesn't work?  Oh well?