Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm using ArcGIS 10.1 for Server and trying to get a FindTask working via this sample and the only difference between my code and the samples that I can see is that the sample data has a find operation enabled.

I can't find in my server manager where to enable this. And is it even necessary? Right now the search isn't returning any results.

ESRI Service

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

Find Task

<style type="text/css">
  html, body { height: 100%; width: 100%; margin: 0; padding: 0; overflow:hidden; }
  body { font-size: 0.9em; font-family: Geneva, Arial, Helvetica, sans-serif;
  } .details { font-weight: bold; } #grid { border:
  1px solid #333;}
<script type="text/javascript">
  dojoConfig = {
    parseOnLoad: true
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.2"></script>
<script type="text/javascript" language="Javascript">

  var findTask, findParams, map;

  function init() {
    var initExtent = new esri.geometry.Extent({"xmin":-9199621.530456403,
    map = new esri.Map("map",{extent:initExtent});
    var censusMapLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://gisprod2/arcgis/rest/services/Dynamic/Zoning/MapServer", {

    //create find task with url to map service
    findTask = new esri.tasks.FindTask("http://gisprod2/arcgis/rest/services/Dynamic/Zoning/MapServer");

    //create find parameters and define known values
    findParams = new esri.tasks.FindParameters();
    findParams.returnGeometry = true;
    findParams.layerIds = [4];
    findParams.searchFields = ["ZONECLASS"];

    dojo.connect(map, 'onLoad', function(theMap) {
      //resize the map when the browser resizes
      dojo.connect(dijit.byId('map'), 'resize', map,map.resize);

  function execute(searchText) {
    //set the search text to find parameters
    findParams.searchText = searchText;
    findTask.execute(findParams, showResults);

  function showResults(results) {
    //symbology for graphics
    var markerSymbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 10, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 0, 0]), 1), new dojo.Color([0, 255, 0, 0.25]));
    var lineSymbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH, new dojo.Color([255, 0, 0]), 1);
    var polygonSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_NONE, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT, new dojo.Color([255, 0, 0]), 2), new dojo.Color([255, 255, 0, 0.25]));

    //find results return an array of findResult.
    var dataForGrid = [];
    //Build an array of attribute information and add each found graphic to the map
    dojo.forEach(results, function(result) {
      var graphic = result.feature;
      dataForGrid.push([result.layerName, result.foundFieldName, result.value]);
      switch (graphic.geometry.type) {
      case "point":
      case "polyline":
      case "polygon":
    var data = {
      items: dataForGrid
    var store = new dojo.data.ItemFileReadStore({
      data: data

Find State/City/River: Layer Name Field Name Value

share|improve this question

2 Answers 2

up vote 2 down vote accepted

ESRI are using http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/2 for the States.

The code:

//create find parameters and define known values
findParams = new esri.tasks.FindParameters();
findParams.returnGeometry = true;
findParams.layerIds = [0, 1, 2];
findParams.searchFields = ["CITY_NAME", "NAME", "SYSTEM", "STATE_ABBR", "STATE_NAME"];

  function execute(searchText) {
    //set the search text to find parameters
    findParams.searchText = searchText;
    findTask.execute(findParams, showResults)

Then the Div contain the returned results for the user to select.

As long as the data is there on your server with those attributes then you should be able to re-create - it is mainly javascript driven apart from the response from ArcGIS server.

share|improve this answer

I think you should enable it in ArcGIS server. First check if your service have this opiton enabled. It should be written like here: http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/ if you wanna to enable it on arcgis server you should: arcgis server manager -> services -> edit your service -> capability and under Web Access check Find.

and then check if this is enabled in the way as I mentioned above.

EDIT: if you wanna to check if is it arcgis server problem or your application you can always connect to esri test server (lik this in example) and check is it working OK. If its working OK - you have to change in arcgis server, if not - you made mistake in code so post your code here..

share|improve this answer
I don't have the option you outlined in my server manager –  Craig Oct 9 '12 at 14:10
@Craig do you have ArcGIS server version 10? –  Krystian Oct 9 '12 at 14:18
We are on version 10.1 –  Craig Oct 9 '12 at 14:24
OK, did you try this: help.arcgis.com/en/arcgisserver/10.0/help/… ? –  Krystian Oct 9 '12 at 14:39
Yes, however, it looks like ESRI changed things up between versions... I tried going through the 10.1 help at: resources.arcgis.com/en/help/main/10.1/0154/… however, it doesn't seem to me doing what I need. –  Craig Oct 9 '12 at 14:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.