This is the function I use for the queries in my app:function queryArcGIS(serviceId, layerId, where, outFields, blnGeomIn, geom, relGeom, blnGeomOut, callback, evt, bUserQuery){
//Workaround Bug NIM-086349 migració 10.1
var random = (new Date()).getTime();
where += " AND " + random + "=" + random;
AG_QueryTask = null;
AG_QueryTask = new esri.tasks.QueryTask("http://mydomain/SIG/rest/services/"+serviceId+"/MapServer/"+layerId);
//Query filter
var query = new esri.tasks.Query();
if (blnGeomIn) {
query.geometry = geom;
query.spatialRelationship=relGeom;
}
query.outSpatialReference = map.spatialReference;
query.returnGeometry = blnGeomOut;
query.outFields = outFields;
query.where=where;
AG_QueryTask.execute(query, function(featureSet) {
callback(featureSet,evt);
}, function(error){
hideLoading();
if (bUserQuery && error.message == "timeout exceeded") {missatge("Error",_("Took too long to answer. Try again"));}
else {errorMessage(error);}
});
It used to work with version 2.1 of the API, but with v. 3.7 I get a "e is undefined" error and I can't find why. I've been checking the esri.tasks.QueryTask and esri.tasks.Query documentation but I don't see what may be causing this error.Firebug console gives me this info:.cache["esri/tasks/query"]/</b<.toJson() /3.7/ (line 484)
.cache["esri/tasks/QueryTask"]/</g<.execute() /3.7/ (line 272)
.cache["esri/geometry/normalizeUtils"]/</B._createWrappers/</b[a.n]() /3.7/ (line 607)
queryArcGIS() myarcgis.js (line 1301)
init() myarcgis.js (line 134)
.cache["dojo/ready"]/</b.addOnLoad/e<() /3.7/ (line 238)
.cache["dojo/ready"]/</h() /3.7/ (line 237)
.cache["dojo/ready"]/</b.addOnLoad() /3.7/ (line 238)
initialize() myarcgis.js (line 51)
onload() index.html (line 1)