Ok, thanks. How would this work for a PopupTemplate? See example below:
currentLayer.on("click", function(evt) {
console.log(evt);
featureId= evt.graphic.attributes.OBJECTID;
currentLayer.queryAttachmentInfos(featureId, function(attach) {
featureUrl=attach[0].url;
currenttemplate = new PopupTemplate({
title: "Current",
fieldInfos: [{
fieldName: "Name",
label: "Name: ",
visible: true
},{
fieldName: "X",
label: "X: ",
visible: true
},{
fieldName: "Y",
label: "Y: ",
visible: true
}],
mediaInfos:[{
"title": "",
"caption": "",
"type":"image",
"value":{
"sourceURL": featureUrl
}
}]
});
currentLayer.infoTemplate=currenttemplate;
},
function(errback) {
console.log(errback);
});
});