Best practice identify task -> query task -> popup

Discussion created by SirReelMX on Jun 19, 2013
Latest reply on Oct 6, 2013 by hbostic
I have an application where I need to use an identify task against multiple layers of a map service. From the identify results, I'm creating an array of features to pass to the infowindow. Now the tricky part, based on some of the feature attributes I need to run a query task against a different service for some more attributes to display in the popup. I'm using the setcontent method of the template to call the querytask. But since this returns a deferred, the data never gets to the popup. If I debug, I can see that the function and query task do execute and return data, I'm guessing since this is essentially a deferred inside a deferred I'm guessing that scope gets lost somewhere. Are there any examples of doing something like this, or is there a better way to go about what I'm trying to accomplish?