It seem crazy to me that the JavaScript API does not support this function that has been available in the REST endpoint of ArcGIS Server since 10.1... I have seen the workarounds for this but WHY is NIM091580 not added to the API yet?
derek swingley Derek Swingley Kelly Hutchins
Is there something major that us end users are unaware of that id holding this up?
Robert,
This was an oversight. We've added it to our list of items to address for the next release of the api (version 3.11).
Kelly
A workaround for this issue until its added to the api would be to use setRequestPreCallback to append returnDistinctValues to the query. Here's an example of how that would look:
esriRequest.setRequestPreCallback(function(ioArgs){
if(ioArgs.url === "http://sampleserver5.arcgisonline.com/arcgis/rest/services/Census/MapServer/2/query"){
ioArgs.content.returnDistinctValues = true;
}
return ioArgs;
});