I'm utilizing Robert Scheitlin's Identify widget and I'm trying to query another map service based on each result items feature centerpoint to return attributes from the map service to be used as parameters in a link within each identify result. I have the link params established within the identify_config file with the "content" element set to " ", which will be populated once the spatial query is complete with the appropriate values. What I have so far is that when the user Identify's for the first time, the spatial query values are null. When the user performs another Identify, the query values are now populated, however, they are from the previous Identify result. Also, if the user selects any other Identify geometry other than "point", it doesn't work.
I currently have my code placed within the showIdentifyResults() function which calls another function (_queryFeatureSub) and passes the identifyGeom parameter. Within the _queryFeatureSub() function is where I query the map service via QueryTask and loop through the attributes to pull the data I need. Later in the showIdentifyResults() function, I loop through the idResult.links, find the specific link I need, and update it with the specific link url populated from the query params.
I think I might need to use Deferred() but not quite sure how to implement this. Or, I might be totally wrong with my thought process. If anyone has some thoughts or input, I'd really appreciate it!