I have a web app that was built with JavaScript API 4.10. One of my layers is a map image layer that includes many sub-layers with some fields that have domains. The issue is that only the domain codes show in the pop-up, but not the values. If I add the map service in AGOL or Portal the domains values show correctly.
Here is the code where this specific map image layer was added:
var Utilities = new MapImageLayer({
url: "https://domain.../arcgis/rest/services/.../Utilities/MapServer",
title: "Utilities - CADD Master Files"
});
Utilities.watch("loaded", function() {
for (i=0;i<Utilities.allSublayers.length;i++) {
var this_layer = Utilities.allSublayers.items[i];
if (this_layer.sublayers == null) {
crtPopUpTemplate(Utilities.url, this_layer.id,this_layer);
}
else {
}
}
})
Code for the pop-up template function (used for almost all layers in the app):
function crtPopUpTemplate(basicURL, layerID, layerVName) {
var url = basicURL+'/'+layerID.toString()+'?f=json';
esriRequest(url, {responseType: "json"}).
then(function(response){
Alldata = response.data;
var titleLayer = Alldata.name;
if (titleLayer.includes('_') == true) {
resultIf = titleLayer.replace(/_/g," ");
} else {
resultIf = titleLayer;
}
let fieldInfosArray = [];
for(let i=0; i<Alldata.fields.length; i++) {
fieldInfosArray[i] = {fieldName: Alldata.fields[i].name, label: Alldata.fields[i].alias}
}
template1 = {
title: resultIf,
content: [{
type: "fields",
fieldInfos: fieldInfosArray
}]
};
layerVName.popupTemplate=template1;
});
}
Any ideas?