<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Troubleshooting Arcade code in ArcGIS Field Maps Questions</title>
    <link>https://community.esri.com/t5/arcgis-field-maps-questions/troubleshooting-arcade-code/m-p/1529788#M9425</link>
    <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;How can I determine what is causing the crash? This is the code I'm using&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;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
}; &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 29 Aug 2024 20:26:26 GMT</pubDate>
    <dc:creator>KenBuja</dc:creator>
    <dc:date>2024-08-29T20:26:26Z</dc:date>
    <item>
      <title>Troubleshooting Arcade code</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/troubleshooting-arcade-code/m-p/1529788#M9425</link>
      <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;How can I determine what is causing the crash? This is the code I'm using&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;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
}; &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2024 20:26:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/troubleshooting-arcade-code/m-p/1529788#M9425</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2024-08-29T20:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: Troubleshooting Arcade code</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/troubleshooting-arcade-code/m-p/1529796#M9426</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Long shot here, but if your variables are fieldAlias for your function, you have it as fieldalias in attributes[fieldalias], maybe changing it to fieldAlias instead may get you past this, otherwise I'm not seeing an issue from this.&lt;/P&gt;&lt;P&gt;Cody&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2024 20:33:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/troubleshooting-arcade-code/m-p/1529796#M9426</guid>
      <dc:creator>CodyPatterson</dc:creator>
      <dc:date>2024-08-29T20:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: Troubleshooting Arcade code</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/troubleshooting-arcade-code/m-p/1529797#M9427</link>
      <description>&lt;P&gt;Thanks for the response. Unfortunately, changing it to fieldAlias didn't make a difference.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2024 20:36:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/troubleshooting-arcade-code/m-p/1529797#M9427</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2024-08-29T20:36:40Z</dc:date>
    </item>
  </channel>
</rss>

