I have a map where I've added an Arcade element to a popup. It works properly when I test in Map Viewer but when I try it in Field Maps, the app crashes and restarts. I've tried looking in the Troubleshooting log, but it only shows the information after the app restarts. In the attached log, I clicked the feature exactly at 4:00 pm and the first log entry is when it restarts several seconds later.
How can I determine what is causing the crash? This is the code I'm using
var fields = Schema(FeatureSetByPortalItem(Portal('url'), 'item')).fields;
var attributes = {};
var fieldInfos = [];
function fieldTest(fieldList, fieldName, fieldAlias) {
if (Includes(fieldList, fieldAlias)) {
attributes[fieldalias] = $feature[fieldName]
Push(fieldInfos, { fieldName: fieldAlias });
}
}
var code = DomainName($feature,"Survey");
for (var i in fields) {
if (code == "Fish and Benthic") fieldTest(["Site ID","Fish Status","Fish Date","Benthic Status", "Benthic Date"], fields[i].name, fields[i].Alias);
else fieldTest(["Site ID","Fish Status","Fish Date"], fields[i].name, fields[i].alias);
}
return {
type: "fields",
fieldInfos: fieldInfos,
attributes: attributes
};