in querytask, returnIdsOnly = true doesn't work

Discussion created by joanv on Dec 9, 2010
Latest reply on Dec 9, 2010 by joanv
Good morning,

I'm experiencing an issue that could be a bug.

I'm using API 2.1 against an ArcGIs Server 10. I'd like to query a feature service and get the IDs resulting from a selection. I'm setting returnIdsOnly  parameter to true to retrieve an array with Ids but for some reason when I use it I get all the fields from the service as a featureset. I checked the resulting url, and (for my surprise) it doesn't contain the returnIdsOnly parameter :confused:, so it's not a problem related to AGS, so I guess it is a bug from the JS API.

This is the extract of code I'm using, and commented the workaround I'm using for the moment.

var QueryTask1 = new esri.tasks.QueryTask("http://server/arcgis/rest/services/../../FeatureServer/2");
var Query1 = new esri.tasks.Query();
Query1.where = "UPPER(field) like UPPER('%sometext%')";
Query1.returnIdsOnly = true;
//Query1.outFields = ['OBJECTID'];
QueryTask1.execute(Query1, showmeRecords);

Any similar experience?

Thank you