How to return a symbol from a queryTask

Discussion created by stevel on May 9, 2012
Latest reply on May 11, 2012 by svakil-esristaff
I'm trying to obtain the symbol which applies to a result returned by a queryTask. Is this possible?

A query allows you to specify the fields to be returned, and whether the geometry should be returned, but it doesn't seem to return the symbol associated with a feature.

The result of the queryTask is a featureSet, comprising the features which satisfy the query. Although feature.symbol is available, I'm finding that it's blank.

To illustrate, put a breakpoint on line 36 of this Query sample and note that results.features[0].symbol is null, even though the source layer does have a renderer.

A workaround is presumably to obtain the renderer associated with the query.URL and build up the symbol this way - any better ideas?