Can you query and find features without using QueryTask? e.g. I want to find out features 'WHERE OBJECTID IN (1000, 2000)' but I don't know the layer and geometry. One way to do is fire feature query to all available layers but that would be little heavy when many layers are on the map. Any idea?
Use queryDefinition.
Is queryDefinition a class in ArcGIS JS API? I don't find it. Can you give link related to queryDefinition?
Sorry. I mean layerDefinitions
Here is the reference with a short sample of how to use it:
arcgisdynamicmapservicelayer-amd | API Reference | ArcGIS API for JavaScript
var layerDefinitions = [];
layerDefinitions[0] = "POPULATION > 5000000";
layerDefinitions[5] = "AREA > 100000";
dynamicMapServiceLayer.setLayerDefinitions(layerDefinitions);