I am using the ArcGIS JavaScript API 4.0 in order to display manholes for a given area. I am using our GIS Service to generate a feature layer. However, all the associated photos for that manhole has to be queried independently. My thought was to find an event handler for when the pop up opens and then somehow query the database for those photos and dynamically place the links in the popup template object. Here are the problems: