When I test this on a deployed application, it shows the tool icon for all popups, even on features without related records. When I click the icon it sticks on the busy indicator and never does anything. When I test it within the builder, it gives me the following error:
Object reference not set to an instance of an object.
at QueryRelatedRecords.AddIns.QueryRelatedTool.resultsLayer_Initialized(Object sender, EventArgs e)
at ESRI.ArcGIS.Client.Layer.OnInitialized(EventArgs e)
at ESRI.ArcGIS.Client.Layer.Initialize()
at ESRI.ArcGIS.Client.FeatureLayer.info_Error(Object sender, TaskFailedEventArgs e)
at ESRI.ArcGIS.Client.FeatureService.FeatureLayerInfo.OnError(Exception err)
at ESRI.ArcGIS.Client.FeatureService.FeatureLayerInfo.Execute_Completed(Object sender, DownloadStringCompletedEventArgs e)
at System.Net.WebClient.OnDownloadStringCompleted(DownloadStringCompletedEventArgs e)
at System.Net.WebClient.DownloadStringOperationCompleted(Object arg)