I have been trying to access related table attributes in a popup for a featureLayer lately and I cannot get it to show results. Accessing the main attributes in popup content works fine as a string of the field name within curly braces or as popup elements where I provide the fieldInfos and fieldName properties.
The documentation shows that related records can be accessed by giving a fieldName like below:
popupTemplate = [{
"type": 'fields',
"fieldInfos": [{
"fieldName": "FACILITY_NAME",
"label": "Facility:"
}, {
"fieldName": "relationships/2/GlobalID",
"label": "Id:"
}]
}];
The ID of my related table is 2 and I was just trying to use GlobalID as an example. The popup returns blank when I use this above example, so it seems like it is trying to access the related records. It shows the popup fine if I only use the first fieldName attribute and comment out the related attribute. I was wondering if pagination automatically adds any related records to the popup as well.
Are there any other settings required when I publish a layer with related records or any other code that is required besides just typing "relationships/2/GlobalID"?