Solved! Go to Solution.
function createQueryDataSourceLayer(mQuery) { var m_queryDataSource = new esri.layers.QueryDataSource(); m_queryDataSource.geometryType = "polygon"; m_queryDataSource.oidFields = ["OBJECTID"]; m_queryDataSource.query = mQuery; m_queryDataSource.spatialReference = new esri.SpatialReference({ wkid: 102100 }); m_queryDataSource.workspaceId = "myworkspace"; layerSource = new LayerDataSource(); layerSource.dataSource = m_queryDataSource; return layerSource; }