Here is some code that you might find helpful. Robert Scheitlin helped me with this section. Alows me to sort the Query Results by a specific field. I nested the If statements to capture all of the different queries. This selects them based on the ID of the service. Add the bold section of code to the existing section for _queryByObjectIds
_queryByObjectIds: function(objectIds, returnGeometry){
var queryParams = new EsriQuery();
queryParams.returnGeometry = !!returnGeometry;
queryParams.outSpatialReference = this.map.spatialReference;
queryParams.outFields = this._getOutputFields();
queryParams.objectIds = objectIds;
var layerId = this._getLayerIndexByLayerUrl(this.currentAttrs.config.url);
if (layerId === 18){
queryParams.orderByFields = ["NAME"];
}
var queryTask = new QueryTask(this.currentAttrs.config.url);
return queryTask.execute(queryParams);
},