Function Using Query and QueryTask

Discussion created by mvolz47 on Apr 7, 2014
I am taking an ESRI Javascript sample of a QueryTask where I have 2 different queries.  The URL of the sample is below;

function (Query, QueryTask, dom, on) {

        var queryTask = new QueryTask("http://server/arcgis/rest/services/OpLayers_D/MapServer/21");

        var query = new Query();
        query.returnGeometry = false;
        query.outFields = [

I have just tried to copy this function and modify the variables queryTask to queryTaskRd and query to queryRd, as well as the mapservice URL and outFields, but the original query no longer works.

Does anyone know what would cause the original query to no longer work?

Do I need to update the function somehow (Query, QueryTask, dom, on)  for the 2nd query?  (e.g. Can I not use Query and QueryTask again without remaining these parameters)

Any help or hints are greatly appreciated.