layerDefinitions property for identifyParams

1351
4
Jump to solution
02-28-2014 03:31 PM
GaryBilotta
New Contributor III
I have seen some old posts regarding the layerDefinitions property for the identifyParams object and how it was not working in the javascript api or is not available, but it is there in the current documentation.  I am trying to use it now with the 3.8 api and arcgis server 10.2.1 with no luck.  Is this property still not working?  Has anyone else been able to get it to work?  I can do an identify task without a problem until I try to set this property of the identifyParams object.  As soon as I try to set this property, I get an error.  I am using it like this identifyParams.layerDefinitions[17]="user='test'".  If I just use the identifyParams and identifTask without that line like this, everything works fine.:

identifyTask = new IdentifyTask("http://" + domain + "/ArcGIS/rest/services/" + ServiceName + "/MapServer");
identifyParams = new IdentifyParameters();
identifyParams.tolerance = 5;
identifyParams.returnGeometry = true;
identifyParams.layerIds = visibleLayers;                   
identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_VISIBLE;


Using fiddler, I get an error "Unable to set property of undefined or null reference". 

Thank you for any help.
0 Kudos
1 Solution

Accepted Solutions
JohnGravois
Frequent Contributor
i was able to add the lines below and confirm things were working in this sample

identifyParams.layerDefinitions = []; identifyParams.layerDefinitions[2] = "OBJECTID > 0"; 


is your own service public?

View solution in original post

0 Kudos
4 Replies
JohnGravois
Frequent Contributor
i was able to add the lines below and confirm things were working in this sample

identifyParams.layerDefinitions = []; identifyParams.layerDefinitions[2] = "OBJECTID > 0"; 


is your own service public?
0 Kudos
GaryBilotta
New Contributor III
Interesting.  Let me try clearing the layerDefinitions first and then set them, that is one thing I am doing differently.  Unfortunately, this is in development and not public yet.  Thank you.
0 Kudos
GaryBilotta
New Contributor III
Well, that seemed to do the trick.  If I don't setup the layerDefinitions array beforehand (identifyParams.layerDefinitions = [];), it doesn't work, but when I do, it does work.  I didn't realize I had to initialize the array first.  Thank you.
0 Kudos
JohnGravois
Frequent Contributor
glad to hear you're sorted out Gary.  please consider marking this thread as 'answered'.
0 Kudos